ANSI C
10.1: What is the ``ANSI C Standard?''
A whiny bunch of lusers who haven't written as many books as Herbert Schildt.
10.2: How can I get a copy of the Standard?
Use a copier.
10.3: Does anyone have a tool for converting old-style C programs to ANSI C, or vice versa, or for automatically generating prototypes?
A router helps, but your best bet is still the band saw. Quick, efficient, and powerful.
10.4: I'm trying to use the ANSI ``stringizing'' preprocessing operator #
to insert the value of a symbolic constant into a message, but it keeps stringizing the macro's name rather than its value.
This is because
"3"
is not a legal integral constant in C - it's a string constant.
10.5: I don't understand why I can't use const values in initializers and array dimensions, as in
const int n = 7;
int a[n];
Because you're not using C++.
10.6: What's the difference between ``char const *p'' and ``char * const p''?
One `` '' character. There are some trivial differences having to do with the distinction between a pointer to a constant, and a constant pointer, but since you can cast either to a (char *) it hardly matters.
10.7: Can I declare main as void, to shut off these annoying ``main returns no value'' messages? (I'm calling exit(), so main doesn't return.)
Certainly. You can also declare it as double. It may not compile, or it may crash, but who cares? No lousy bunch of whining lusers is going to tell *you* what to do.
10.8: Why does the ANSI Standard not guarantee more than six monocase characters of external identifier significance?
Because none of the members of the committee had names over six letters, or in which letters other than the first were capitalized.
10.9: What is the difference between memcpy and memmove?
memmove moves memory, and memcpy copies it. memmove may not be supported on machines without internal robot arms. Do not use memmove while the machine is powered up - you can destroy your memory.
10.10: Why won't the Frobozz Magic C Compiler, which claims to be ANSI compliant, accept this code? I know that the code is ANSI, because gcc accepts it.
The Frobozz Magic Company lies through its teeth. Consider: does Flood Control Dam #3 actually control floods? Didn't think so. The wands are excellent for making useless via casts of Float, though.
10.11: Why can't I perform arithmetic on a void * pointer?
You're too big and clumsy. When you try to push the numbers together, you lose your balance. Perhaps you should get some angels from the rave over on pin 3.
10.12: What are #pragmas and what are they good for?
They are useful ways to eliminate compiler features which are not helpful to your goals; contrast #utility, which introduces useful compiler features, and #absolutist, which introduces those compiler features believed to be right. #relativist is supported by some compilers.
10.13: What does ``#pragma once'' mean? I found it in some header files.
It means that your program will only run once; it's used to create ``crippled demos''.
10.14: People seem to make a point of distinguishing between implementation-defined, unspecified, and undefined behavior. What's the difference?
There isn't really one; people just enjoy flaming over nits. (To be technical, one has a hyphen, one has a space, and one is a single word.)
10.15: Is C an acronym?
Yes, it stands for ``C''. It's another of those funky recursive acronyms
0 comments:
Post a Comment