I’m a foreigner reading C99, while a sentence (in 6.7.1) makes me confused:
- ‘(A declaration of an identifier for an object with storage-class
specifier register suggests that access to the object be as fast as
possible.) The extent to which such suggestions are effective is
implementation-defined.‘
How should I parse the second sentence :
- The extent to, which such suggestions are effective, is implementation-defined.
- The extent, to which such suggestions are effective, is implementation-defined.
which one is better?
Does that means an implementation has full powers to decide how to deal with register, even with a termination of translation?
Thanks.
No — the extent to which the suggestions are effective, is implementation defined, but the effect of the code as a whole is not.
To put it slightly differently, when/if you put
registerinto your code (where allowed), the compiler can completely ignore it — and I feel obliged to add that nearly all reasonably modern compilers will.Nonetheless, the mere presence of
registerwon’t prevent the code from compiling, unless you try to apply it somewhere it’s not allowed (e.g., to a global variable).Bottom line: don’t use it, but don’t worry about removing it from code that already has it either. It’s a waste of time and effort, but with reasonably modern compilers a completely harmless one.