Jump to content

Talk:C (programming language)/Archive 14

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by MiszaBot I (talk | contribs) at 01:08, 31 May 2013 (Robot: Archiving 2 threads from Talk:C (programming language).). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Archive 10Archive 12Archive 13Archive 14Archive 15Archive 16Archive 17

Hello world, revisited

The standards-compliant "hello, world" example is only compliant for C99 and higher. I think it needs to be clarified that it isn't compliant with C89. — Preceding unsigned comment added by Tommyinla (talkcontribs) 06:53, 17 February 2013 (UTC)

What's not C89 compliant about it? The only thing I can see is that implicit "return 0" at the end of main() is more clearly and explicitly defined in C99, although it *is* defined in C89 (2.1.2.2 Hosted environment (...) "Program termination" (...) A return from the initial call to the main function is equivalent to calling the exit function with the value returned by the main function as its argument. If the main function executes a return that specifies no value, the termination status returned to the host environment is undefined. and 3.6.6.4 The return statement (...) Reaching the } that terminates a function is equivalent to executing a return statement without an expression.). Rwessel (talk) 12:01, 17 February 2013 (UTC)
According to the two clauses that you specified, there *is* an implicit return from main. However, the return value is undefined. Correct me if I'm wrong, but undefined behavior != standards compliant. Tommyinla (talk) 19:05, 17 February 2013 (UTC)
You're quite correct, the value returned from main without an explicit value specifying return is undefined in C89, I was thinking of a slightly different case. But exiting main at the closing brace clearly *is* defined (which should have been my point). In any event, invoking undefined behavior only makes the program not “strictly conforming” (1.7 COMPLIANCE - A strictly conforming program shall use only those features of the language and library specified in this Standard. It shall not produce output dependent on any unspecified, undefined, or implementation-defined behavior, and shall not exceed any minimum implementation limit.). But I don't think this is actually undefined behavior in the usual C sense, rather just the value returned to the host environment (and clearly the program is still defined to successfully return to the host environment, but with some undefined exist status). Any issues the host environment had with that would clearly not be an issue for the C program, which has successfully finished executing. Rwessel (talk) 23:22, 17 February 2013 (UTC)
Interesting point you make. I suppose we can say it's conforming. I did reword the last paragraph of that section though. It specifically stated that 0 was the implicit return value. I modified the verbiage to include, "According to C99 and newer." Tommyinla (talk) 12:16, 18 February 2013 (UTC)

pointer

detail of pointer . — Preceding unsigned comment added by 117.229.112.206 (talk) 14:09, 23 August 2012 (UTC)

Huh? You want us to explain pointers? This is Wikipedia, not a How-To site, unfortunately. --Carrot Lord (talk) 00:32, 20 January 2013 (UTC)
If I understand what you're trying to say, pointers are explained under Pointer (computer programming) Julesmazur (talk) 04:36, 19 February 2013 (UTC)
Alternatively, see this. — Preceding unsigned comment added by Julesmazur (talkcontribs) 15:49, 19 February 2013 (UTC)

SVG version of K&R1 book cover?

Someone has done an SVG of the K&R1 cover, and changed the article to display that. Do we really want a *drawing* of the book cover rather than an actual image? Even though it's fairly close? (The font weights are at least a bit different, for example, but it is close). Rwessel (talk) 12:05, 17 February 2013 (UTC)

"close", but blurred. TEDickey (talk) 13:48, 17 February 2013 (UTC)
Actually, that was me. The original image was very low-res, the name of the publisher was literally unreadable. I can try and make a more accurate version, if you don't want to revert to the low-res raster image. Julesmazur (talk) 04:13, 19 February 2013 (UTC)
I'm wondering if the drawing is really OK at all, policy-wise? I have a K&R1, in passably good condition, I'd be happy to upload a scan, although I'm not sure of the copyright status of that. And if that's a problem, wouldn't that impact the SVG as well? Rwessel (talk) 10:20, 19 February 2013 (UTC)
Well, the original image was out of copyright (in the public domain). With a cover this simple (very little actual design), you also have to consider that certain copyright bureaus might not even grant this kind of design copyright status. Julesmazur (talk) 14:46, 19 February 2013 (UTC)
Here's the original file (I can't get the internal link to display properly). It's "ineligible" for copyright, is in the public domain, and has one banner recommending vector conversion, and another recommending at least dropping the JPEG format. The description is in the wrong language, and the source is Google Books. Julesmazur (talk) 15:05, 19 February 2013 (UTC)