Talk:C (programming language)/Archive 12: Difference between revisions

Content deleted Content added
MiszaBot I (talk | contribs)
m Robot: Archiving 9 threads from Talk:C (programming language). (ARCHIVE FULL)
 
MalnadachBot (talk | contribs)
m Replaced obsolete font tags and reduced Lint errors. (Task 12)
 
Line 21:
:''A standards-compliant and portably written C program can be compiled for a very wide variety of computer platforms and operating systems with little or no change to its source code.''
is not well balanced, a port usually needs '''some''' port recoding because of the unstandardized signed/unsigned and wchar_t policies of different compilers, and no change only for rare trivial code. [[User:Rursus|Rursus]] dixit. ([[User talk:Rursus|<span style="color: red; background: #FFFF80"><sup>m</sup><u>bork<sup>3</sup></u></span>]]!) 10:29, 18 December 2010 (UTC)
:Thing is, the sources cited purport to measure "popularity", not amount of use (whatever that means in this context). To phrase otherwise would be to misconstrue the sources. Portability issue addressed. --[[User:Cybercobra|<b><font colorstyle="color:#3773A5;">Cyber</font></b><fontspan colorstyle="color:#FFB521;">cobra</fontspan>]] [[User talk:Cybercobra|(talk)]] 00:34, 19 December 2010 (UTC)
:: The distinction between "popular" and "used" is lost on me. If some aspects are "annoying", that seems a different issue. [[Special:Contributions/97.126.54.135|97.126.54.135]] ([[User talk:97.126.54.135|talk]]) <span style="font-size: smaller;" class="autosigned">—Preceding [[Wikipedia:Signatures|undated]] comment added 07:56, 29 December 2010 (UTC).</span><!--Template:Undated--> <!--Autosigned by SineBot-->
:: I think it is fair to say that C is well suited for writing portable programs. Yes, some changes are usually needed to the source code. Obviously UNIX does not have drive letters, Windows does. There is the matter of '/' vs '\'. And there are surely other differences that need to be taken into account. Some other languages are also rather portable, but in a different kind of way. Java can run in any JVM (and use JIT), Javascript can run in any browser, perl can run in any perl interpreter. There are surely other examples of portable languages. However, a difference seems to be that the low-level nature of the C language and close relationship to assembly language makes it easier to write a C compiler for any cpu, and then C is portable as a machine-language executable to that architecture. Also, I would say the C preprocessor makes it much easier to write portable programs. [[Special:Contributions/97.126.54.135|97.126.54.135]] ([[User talk:97.126.54.135|talk]]) 08:31, 29 December 2010 (UTC)
Line 45:
printf("%s\n", "hello, world")
[[User:Old wombat|Old_Wombat]] ([[User talk:Old wombat|talk]]) 11:37, 25 April 2011 (UTC)
:Gonna need a more specific citation than an entire website. --[[User:Cybercobra|<b><font colorstyle="color:#3773A5;">Cyber</font></b><fontspan colorstyle="color:#FFB521;">cobra</fontspan>]] [[User talk:Cybercobra|(talk)]] 14:05, 25 April 2011 (UTC)
 
:That claim is made occasionally, it's not correct. It *is* a very bad idea to pass in an unknown format string to printf(). Thus ps="hello, world"; ... printf(ps); is risky if you don't know for sure that ps points to a valid format string. And if the string to be printed contains any escapes("%") that printf will try to interpret, it requires special care to pass as the first parameter. But obviously neither of those apply in this case. [[User:Rwessel|Rwessel]] ([[User talk:Rwessel|talk]]) 15:57, 25 April 2011 (UTC)
Line 70:
 
[[User:Old wombat|Old_Wombat]] ([[User talk:Old wombat|talk]]) 11:43, 25 April 2011 (UTC)
:Basis for your claim? --[[User:Cybercobra|<b><font colorstyle="color:#3773A5;">Cyber</font></b><fontspan colorstyle="color:#FFB521;">cobra</fontspan>]] [[User talk:Cybercobra|(talk)]] 14:07, 25 April 2011 (UTC)
::Here's "a" basis for such a claim: ''The C Programming Language'' (Brian W. Kernighan, Dennis M. Ritchie, Prentice-Hall, 1978). In the description of the first "hello, world" program, (p4) "The braces { } enclose the statements that make up the function; ..." First mention of "bracket" in connection with use in a C program. Not "first ever", but likely the first in book form. Also, in the REAL standard prior to 1998, ''C A Reference Manual'' (Samuel P. Harbison, Guy L. Steele, Prentice-Hall, 1984) Section 7.3.4(p.146) begins, "A subscripting expression consists of a primary expression, a left bracket, an arbitrary expression, and a right bracket."