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: Set the result of void function Date: Fri, 29 Sep 2017 16:44:44 -0700 Organization: None to speak of Lines: 34 Message-ID: References: <6308c8a5-6a1e-4667-bac4-1cdaf18e7e55@googlegroups.com> <5b6b3759-5c3e-4b65-9c54-a96ccc0dd393@googlegroups.com> <596f824f-b750-47f1-9d66-60873e73ceef@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="ff57beef5455ded33558df3df0c00532"; logging-data="13790"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/5RWoTMBCcij5a8SC0RWVS" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:zkQqhS3NdsggLDqz0cfCCIFFk0M= sha1:p4sv3LezXFcbiLH92We8mYcGCtc= Xref: csiph.com comp.lang.c:120591 David Kleinecke writes: > On Friday, September 29, 2017 at 11:23:36 AM UTC-7, Keith Thompson wrote: [...] >> What point were you trying to make? > > I didn't think I was being that obscure. I was saying > that if we have no information about suitable arguments > then we could write > > int not_printf (); > not_printf ("Hello World"); > not_printf ("uses %d words", 2); > > and get the expected result - assuming we knew the > implementation always got the arguments in the right > places. Perhaps so. Of course any such code relies on explicitly undefined behavior, and the code that implements not_printf() would have to use implementation-specific methods to obtain the argument values. That's ugly and error-prone, and it's exactly why C since 1989 has provided more reliable mechanisms. (Your reuse of the name "printf", your showing a definition of a printf function that explicitly has no parameters, and your statement that is not required without mentioning freestanding implementations all contributed to the 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"