Why is it possible to do something like: mov %rbx, %rcx  But not to do: mov %rip, %rax # lea (%rip), %rax  Why is this the case, and how does call go about calculating the return address?
69273
Can the program counter on Intel CPUs can be read directly (that is without 'tricks') in kernel mode or some other mode?
86999
Admittedly I don't get it. Say you have a memory with a memory word of length of 1 byte. Why can't you access a 4 byte long variable in a single memory access on an unaligned address(i.e. not divisible by 4), as it's the case with aligned addresses?
84371
In ANSI C, offsetof is defined as below.  #define offsetof(st, m) \     ((size_t) ( (char *)&amp;((st *)(0))-&gt;m - (char *)0 ))   Why won't this throw a segmentation fault since we are dereferencing a NULL pointer? Or is this some sort of compiler hack where it sees that only address of the offset is taken out, so it statically calculates the address without actually dereferencing it? Also is this code portable?
10337
Why do we use ./filename to execute a file in linux?  Why not just enter it like other commands gcc, ls etc...
50449
I'm a beginner in assembly language and have noticed that the x86 code emitted by compilers usually keeps the frame pointer around even in release/optimized mode when it could use the EBP register for something else.  I understand why the frame pointer might make code easier to debug, and might be necessary if alloca() is called within a function.  However, x86 has very few registers and using two of them to hold the location of the stack frame when one would suffice just doesn't make sense to me.  Why is omitting the frame pointer considered a bad idea even in optimized/release builds?
54115
I've been digging through some parts of the Linux kernel, and found calls like this:  if (unlikely(fd &lt; 0)) {     /* Do something */ }   or  if (likely(!err)) {     /* Do something */ }   I've found the definition of them:  #define likely(x)       __builtin_expect((x),1) #define unlikely(x)     __builtin_expect((x),0)   I know that they are for optimization, but how do they work? And how much performance/size decrease can be expected from using them? And is it worth the hassle (and losing the portability probably) at least in bottleneck code (in userspace, of course).
11950
If you are writing a program that is executable from the command line, you often want to offer the user several options or flags, along with possibly more than one argument. I have stumbled my way through this many times, but is there some sort of design pattern for looping through args and calling the appropriate handler functions?  Consider:  myprogram -f filename -d directory -r regex   How do you organize the handler functions after you retrieve the arguments using whatever built-ins for your language? (language-specific answers welcomed, if that helps you articulate an answer)
21752
I'm a beginner C programmer, and I assumed that this would be the case, but would like some affirmation if possible.  If they are the same, why not just take one argument instead?
10348
How does the ping command really work?  Specifically where does the ARP (Address Resolution Protocol) come into picture?   I was asked this question in an interview and I was not able to come up with a scenario when ARP could be used.
111951
The idea would be to use it as... a pipe in a command. For instance: say there's some kind of long path which has to be retyped again and again, followed by a pipe and a second program, i.e.  "directory1/directory2/direcotry3/file.dat | less -I "   I'd like that part to be stored in a variable, so it could be used like this:  r="directory1/directory2/direcotry3 \| less -I -p " $ cat path1/path2/$r &lt;searchterm&gt;   Instead, I get  cat: invalid option -- I Try `cat --help' for more information.   ... meaning the pipe clearly didn't work.
76617
What does ` mean in this output from lsblk?
44627
Is there some chance to know how a binary was built, under Linux? (and or other Unix)  Compiler, version, time, flags etc...  I looked at readelf and couldn't find much, but there might be other ways at analyzing the binary code/section etc...  Anything you know how to extract?
78101
Is it possible to see the return value of a method after the line has been run and before the instruction pointer returns to the calling function?  I am debugging code I can't modify (read: don't want to re-compile a third party library), and sometimes it jumps to code I don't have source to or the return expression has side effects that stop me being able to just run the expression in the Display tab.  Often the return value is used in a compound statement, and so the Variables view will never show me the value (hence wanting to see the result before control returns to the calling function).  UPDATE: I can't use the expression viewer as there are side-effects in the statement.
122811
Occasionally I need to specify a "path-equivalent" of one of the standard IO streams (stdin, stdout, stderr).  Since 99% of the time I work with Linux, I just prepend /dev/ to get /dev/stdin, etc., and this "seems to do the right thing".  But, for one thing, I've always been uneasy about such a rationale (because, of course, "it seems to work" until it doesn't).  Furthermore, I have no good sense for how portable this maneuver is.  So I have a few questions:   In the context of Linux, is it safe (yes/no) to equate stdin, stdout, and stderr with /dev/stdin, /dev/stdout, and /dev/stderr? More generally, is this equivalence "adequately portable"?   I could not find any POSIX references.
111379
How do I evaluate or calculate the return value of a command line? For exemple, I count the number of lines with a grep and I want to know if that value is above X. If so, I want to print the number to a file.  Or I want to substract the value of a grep count to another grep count...  How can I manipulate return values that way ?
82069
I doubt it can be done portably, but are there any solutions out there?  I think it could be done by creating an alternate stack and reseting SP,BP, and IP on function entry, and having yield save IP and restore SP+BP.  Destructors and exception safety seem tricky but solvable.  Has it been done?  Is it impossible?
48449
I wrote a program that uses POSIX memory-mapping function (mmap)  The program takes a file (a.dat) and memory-maps it for reading/writing.  Due to errors in the program, every time I run the program a file with some weird names (e.g., ?d?P?^z??d?P?^z?) is created. The error is resolved but I am not able to delete the files.  I am not able to delete it either using command line or by select/deleting from window manager.  So how should I delete it? I'm using Ubuntu 11.04.