• 0 Posts
  • 4 Comments
Joined 7 days ago
cake
Cake day: March 13th, 2025

help-circle
  • mina86@lemmy.wtftoLinux@lemmy.mlLinux Terminal: CTRL+D is like pressing ENTER
    link
    fedilink
    English
    arrow-up
    11
    arrow-down
    1
    ·
    edit-2
    7 hours ago

    It’s not. You keep insisting that ^D doesn’t send EOF and yet:

    $ stty -a | grep eof
    intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
    $ man stty |grep -A1 eof |head -n2
           eof CHAR
                  CHAR will send an end of file (terminate the input)
    

    ^D is the EOF character. The thing is that in C every line of a text file must be terminated by a new-line. And so, when you end a file with ^D without a return, you get funky results.




  • This is too simplistic example to give any meaningful answer. What’s Type? What’s value? If it’s i32 and 42 than they both compile to the exact same thing. But if Type is Drop than the second will call the destructor on each iteration. (I’ve also written previously about similar example with BorrowedBuf1).