Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Register Variables

Name: Anonymous 2011-09-25 10:47

How exactly do register variables work in C? When should they be used? K&R touches upon them briefly but moves right along. Is there any source in which I can read about them in depth?

Name: Anonymous 2011-09-25 22:29

>>1
You shouldn't use register. You will only limit your possibilities doing so (de/referencing). Most modern compilers will optimize your program so that you wouldn't really spot performance differences anyway. Also, I am aware of some compilers/parsers that will ignore this keyword fully.
>>27
Confirmed for TCC. This works:
void emptyvar;
int emptyarray[0];
printf("A = %d, B = %d\n", emptyvar, emptyarray[0]);

...which results in undefined behaviour but without an error/warning. Also note that the two empty variables do have memory addresses.
GCC doesn't like it though.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List