arnuld wrote:
>> On Mon, 08 Jun 2009 23:44:30 -0700, Keith Thompson wrote:
>
>>> writes:
>>> Is void main legal in C....I know according to the standards it is
>>> illegal in C++....
>
>> The C standard doesn't use the word "legal" or "illegal" in that
>> sense.
>
>
> Just want to know, if someone uses void main() what word I should use (if
> illegal is not the one).
In general, there's no single word that can be substituted for
"illegal". You generally need multiple words, and you need different
words in different contexts, and you might need to reorganize other
parts of your sentence to make those words fit in. In most cases where
you would want to say (incorrectly) that a piece of C codes "is
illegal", the more accurate wording is one or more of the following:
"is a constraint violation"
"is a syntax error"
"exceeds a minimum implementation limit"
"has undefined behavior"
In some cases, whether or not one of the above phrases applies depends
upon unspecified behavior, in which case you need to prefix your
statement with something like "it is implementation-specific whether
....". If the implementation is required to document which choice it
makes for unspecified behavior, you can replace "specific" with "defined".
In this particular case, you would say "It is implementation-defined
whether or not void main() is supported. If it is not, use of void
main() has undefined behavior".
A more general statement, that covers all of the above, is
"non-portable". A fully conforming compiler is free to define behavior
that the C standard leaves undefined, to set its own implementation
limits higher than the minimum levels, and to accept code that contains
syntax errors or constraint violations. Therefore, whether or not a
given piece of code will cause you trouble always depends upon which
conforming compiler you use.
Therefore, any language-specific (as opposed to algorithmic) problem
with C code, no matter how severe, is technically merely a portability
issue. However, "non-portable" means different things to different
people, so it's better to be more specific, if you can be.