Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Date: Fri, 13 Jan 2017 15:56:16 -0800 Organization: None to speak of Lines: 39 Message-ID: References: <06544819-1f87-4e1c-94ca-918f049d1d42@googlegroups.com> <5bf5dcb7-ef8c-4d6b-aa1b-11f0522651b7@googlegroups.com> <5d426729-992a-4edc-ae91-725fa2420ea5@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="ba0db46df61d502ee0e6afe10bb5a782"; logging-data="32712"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18upVANDQvdv7IviWo9GPrr" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:vwLNDCA6k4sv2UNYXiZVygRpQtU= sha1:LVlbAdx84irZ/+eYMK9+W5el5NM= Xref: csiph.com comp.lang.c:101690 supercat@casperkitty.com writes: > On Friday, January 13, 2017 at 5:09:10 PM UTC-6, Tim Rentsch wrote: >> supercat writes: >> > [...] My point is that the C Standard is not, *in and of itself*, >> > sufficient to write useful programs; [...] >> >> Hogwash. The set of such programs may not be as large as >> some people would like, but it certainly is larger than >> the empty set. > > True or false: The Standard allows conforming implementations to > behave in arbitrary fashion if certain implementation limits--most > notably runtime stack depth--are exceeded. > > True or false: The Standard requires that each implementation be > capable of processing at least one program which nominally exercises > certain implementation limits, but would not forbid an implementation > from meeting that requirement through the use of special optimizations > which are applied only to that one exact program. > > Can you offer up any source text which would be guaranteed not to exceed > any implementation limits, in such fashion as to invoke Undefined Behavior, > on any conforming implementation? True, true, and no, respectively, but hardly relevant. Nevertheless, one can write useful C programs using only information provided by the C standard. There needn't be a 100% binding guarantee that a program works as expected on all possible conforming implementations for that program to be useful. Just as an optimization, perhaps consider leaving the goal posts where they are. -- 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"