Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Problem with the function that should display new letter Date: Wed, 28 Oct 2015 07:07:26 -0700 Organization: None to speak of Lines: 39 Message-ID: References: <35a13b2e-2412-40ea-89e4-1985879e542c@googlegroups.com> <34ba9d6a-42ad-4d2d-9405-5c46b98369b8@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="4016"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19qN6bvYTwVL9Daqqi5H1er" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:ovWAHmBh0Bx8A5MssljwrzQZ2bA= sha1:9lfFvtImrqqfy3UYBayrJPKjapo= Xref: csiph.com comp.lang.c:74080 Bartc writes: > On 28/10/2015 08:35, Richard Heathfield wrote: >> So, in any hosted implementation (such as the one you are using), the >> interface to main must be either: >> >> int main(void); >> OR >> int main(int argc, char **argv); > > (That's what I used to think. But you don't get the latter interface > automatically, not under Windows anyway. > > The only interface the OS recognises is 'int main(void)' (or 'int > anyfunction(void)' depending on what entry point name is used in the > executable). > > The use of 'main(argc, argv)' requires that the C implementation > arranges to call an internal function which obtains these arguments from > the OS. It's usually done transparently so that it looks like the OS > calls main(argc, argv) directly. You say it's not done automatically; then you say it's "usually done transparently". Sounds like it *is* done automatically. It doesn't matter whether the OS calls main directly, or whether it "looks like" it does so. The point is that it works. > You find this stuff out when, for example, you try and use the 'ld' > linker directly without going through gcc.) So don't do that. Sure *you* might have circumstances where that might be necessary. Alla doesn't. You're adding needless confusion. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"