Pretty sure it is true for all variables on a computer (ie. binary based).
Not if you want portable code. In particular, if you try this in C, it will likely fail unpredictably. The reason for this is that the C standard allows implementations to insert "padding bits" into non-integer variables; if those padding bits have any special meaning to the system, you're screwed.
Also, not all binary values need have a valid representation. These values are refered to as "trap values", and will often cause a program to abort.
This has been discussed several times on comp.lang.c; here's on of them: "question about FAQ, swapping values".
void main() is not and never has been standard C. Unless you're programming for a freestanding implementation (usually an embedded system), this causes undefined behaviour.
(yes, I read too much comp.lang.c)
Re:Here's some immortal code...
on
Immortal Code
·
· Score: 2, Funny
Unfortunatley, void main() has never been valid ANSI/ISO C. The standard states that main() shall return an int. Also note that the latest standard (C99) requires the type specifier to be present; you can no longer rely on main() defaulting to int.
Output is not guaranteed to be displayed until either a newline is encountered, or a call is made to fflush(). So it is perfectly possible that the user will never see anything.
For maximum portability, it is recommended that you return EXIT_SUCCESS or EXIT_FAILURE from main(). So, here is the correct version: #include <stdio.h> #include <stdlib.h>
int main(void) { if (printf("Hello, World!\n") < 0)) return EXIT_FAILURE; else return EXIT_SUCCESS; }
The Sega Genesis had the ability to run games from Sega's previous console the Master System. The Genesis was a 68000-based console, but it used a Z80 for sound processing. You could buy a converter that adapted your old Master System cartridges to the Genesis form and ran them on the sound processor.
Or you could, you know, right-click the icon and choose "rename". Just like every other icon on the desktop.
Not if you want portable code. In particular, if you try this in C, it will likely fail unpredictably. The reason for this is that the C standard allows implementations to insert "padding bits" into non-integer variables; if those padding bits have any special meaning to the system, you're screwed.
Also, not all binary values need have a valid representation. These values are refered to as "trap values", and will often cause a program to abort.
This has been discussed several times on comp.lang.c; here's on of them:
"question about FAQ, swapping values".
void main() is not and never has been standard C. Unless you're programming for a freestanding implementation (usually an embedded system), this causes undefined behaviour. (yes, I read too much comp.lang.c)
Unfortunatley, void main() has never been valid ANSI/ISO C. The standard states that main() shall return an int. Also note that the latest standard (C99) requires the type specifier to be present; you can no longer rely on main() defaulting to int.
Output is not guaranteed to be displayed until either a newline is encountered, or a call is made to fflush(). So it is perfectly possible that the user will never see anything.
For maximum portability, it is recommended that you return EXIT_SUCCESS or EXIT_FAILURE from main(). So, here is the correct version:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
if (printf("Hello, World!\n") < 0))
return EXIT_FAILURE;
else
return EXIT_SUCCESS;
}
The Sega Genesis had the ability to run games from Sega's previous console the Master System. The Genesis was a 68000-based console, but it used a Z80 for sound processing. You could buy a converter that adapted your old Master System cartridges to the Genesis form and ran them on the sound processor.