Talk:C (programming language): Difference between revisions

Content deleted Content added
m Archiving 1 discussion(s) to Talk:C (programming language)/Archive 17) (bot
Line 24:
}}
{{archives|bot=MiszaBot I|search=yes|age=100|dounreplied=yes}}
 
== improving the "hello world" example ==
 
Rather than an blind "afaik", a [[WP:RS|reliable source]] is needed to alter an example which has a valid reliable source. [[User:Tedickey|TEDickey]] ([[User talk:Tedickey|talk]]) 10:15, 22 October 2023 (UTC)
 
:'''Give in''': Meanwhile, I checked the program using gcc 11.4.0 under Ubuntu. It seems the a missing <code>return</code> leads to a warning - ''except'' in <code>main()</code>, so {{u|Tedickey}} is right. As a side remark, I don't see a source given for the 2nd version. - [[User:Jochen Burghardt|Jochen Burghardt]] ([[User talk:Jochen Burghardt|talk]]) 10:21, 22 October 2023 (UTC)
 
::Quoting from ''ISO/IEC 9899:1999(E)'', section 5.1.2.2.3 '''Program termination''':
<blockquote>If the return type of the main function is a type compatible with int, 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; reaching the '''}''' that terminates the main function returns a value of 0.
</blockquote>
::Perhaps C11 changes that, but again, a [[WP:RS]] helps [[User:Tedickey|TEDickey]] ([[User talk:Tedickey|talk]]) 15:19, 22 October 2023 (UTC)
 
::Regarding the comment that a diagnostic is required: I don't see that in the standard. Perhaps it's another instance of people confusing a particular implementation with the standard [[User:Tedickey|TEDickey]] ([[User talk:Tedickey|talk]]) 15:35, 22 October 2023 (UTC)
 
== Mention of C allowing various memory allocations schemes ==