Re: C Program [ Turbo-C ] , to extract only-Printable-characters from a file ( any type of file) and display them ( i.e equivalent to "strings" command in UNIX)



Lawrence Kirby <lknews@xxxxxxxxxxxxxxx> wrote:
> On Mon, 04 Jul 2005 15:47:41 -0700, Old Wolf wrote:
>
>> Lawrence Kirby wrote:
>>> On Sun, 03 Jul 2005 19:27:48 -0700, Old Wolf wrote:
>>> > Emmanuel Delahaye wrote:
>>> >> SunRise wrote on 02/07/05 :
>>> >>
>>> >>> void main()
>>> >>
>>> >> main() returns int. Always.
>>> >
>>> > In fact the OP's implementation defines "void main(void)" as
>>> > a valid form of main.
>>>
>>> Does it define it formally as an extension or just use it in code
>>> examples? But even if it does that doesn't make the construct valid C,
>>> just valid for that implementation.
>>
>> Well, does the Standard define how an implementation must
>> define its implementation-defined behaviours? :)
>
> C99 says "or in some other implementation-defined manner". The key thing
> about "implementation-defined" is that the implementation must document
> it. So C99 formalises the idea that aform of main() is valid on an
> implementaton not because it "happend to work" but because the the
> implementation documents it as an extension.
>
>> Anyway, I think this qualifies as an exception to "Always",
>> as Emmanuel Delahaye wrote.
>
> In the context of standard C, the topic of this newsgroup, "Always" is
> correct. OK I see an argument that the bit from C99 above legitimises
> documented extensions. I don't like this though because the standard
> doesn't constrain the bahaviour of implementation-defined forms, you
> effectively have undefined behaviour under an implementation-defined
> label. This goes against the nature of the term "implementation-defined"
> which usually gives the implementation a restricted choice of possible
> behaviours. The bottom line is that C99 doesn't specify any behaviour for
> void main(void) and in my book that makes void main(void) an invalid
> construct in C99.

I don't understand what is "undefined" about `void main(void)', would
you please expand on that? ISTM that in defining behaviour the Std
does not distinguish between different `main' forms, and defines it
only where applicable; in `void main(void)' case, the termination
status is (explicitly) unspecified.

--
Stan Tobias
mailx `echo siXtY@xxxxxxxxxxxxxxxxxxxxxxxxxx | sed s/[[:upper:]]//g`
.



Relevant Pages

  • Re: C Program [ Turbo-C ] , to extract only-Printable-characters from a file ( any type
    ... > Lawrence Kirby wrote: ... C99 says "or in some other implementation-defined manner". ... So C99 formalises the idea that aform of mainis valid on an ... implementation documents it as an extension. ...
    (comp.lang.c)
  • Re: good c compiler
    ... use of this wonderful extension"; the standard says nothing about the ... I have worked for years in this project, and C99 is supported with all ... important features there. ... often in somewhat broken English, ...
    (comp.lang.c)
  • Re: Questions about C1x
    ... extension, changing the implementation to return a string containing ... presented in the standard, and they're not what you think they are. ... You have invented out of thin air a rule that the inputs to asctime() ... , but it just doesn't exist in C99. ...
    (comp.std.c)
  • Re: Need some explanation
    ... Richard Heathfield wrote: ... >> What changed between C90 and C99 is that what was an extension ... >> in C90, can now be allowed, ie. a compiler does not cease to be ...
    (comp.lang.c)
  • simple isapi extension : memory leak detected
    ... extension was coming from, so I built a super simple MFC isapi with the ... unloaded (there's always 4 reported leaks). ... void CtestIsapiExtension::emptyTest(CHttpServerContext* pCtxt) ...
    (microsoft.public.inetserver.iis)