Talk:C (programming language)/Archive 6

Jokes
Blatant jokes should not be placed in serious articles in Wikipedia, regardless of whether the joke is "standard" or not. Wikipedia should aim for a semblance of professionalism, and jokes do nothing to contribute to this. Dysprosia 11:45, 11 May 2006 (UTC)


 * Agreed. --ozzmosis 12:04, 11 May 2006 (UTC)


 * Disagree. Several articles that I watch have well-crafted bits of humour and levity in them. As long as the humour is either obvious or identified as such, there's nothing that makes that "unencyclopaedic" or even "unprofessional".


 * Atlant 13:03, 11 May 2006 (UTC)


 * If we are taking a vote, I don't see any reason for a section on "Jokes about C". Also, I've been programming in C for over 25 years, and I've never heard any of those jokes.  The only one that I would consider "standard" would be "a high level assembly language". wrp103 (Bill Pringle) 00:03, 12 May 2006 (UTC)


 * Agreed. --FredricRice 12:04, 28 Sep 2007 (UTC)


 * One issue is that "C" was supposedly started as a joke, one that got out of hand once the versitality resulted in endless applications actually being written in it. There have been no outright admissions of "C" being started as a joke by KorR but there have been hints.  Comments of amusement on how "C" is "still being used" have reportedly been made by KandR on rare occasion.  There's been some recognition that the name of the programming language started as a minor joke, though there is what's been called "the existential absurdity of the semicolin" which tends to lend credibility to the suggestion that the language as a whole started as a joke.  —Preceding unsigned comment added by 65.168.158.195 (talk) 23:26, 28 September 2007 (UTC)


 * That is one of the most ignorant comments made here yet. No wonder he wanted to remain anonymous. — DAGwyn 05:15, 29 September 2007 (UTC)

remove links
Can I know why a simple tutorial would be removed ? http://www.alnaja7.org/Programmer/101/itcs_101.htm Alhoori 21:48, 20 May 2006 (UTC)
 * The issue has already been addressed on your talk page.  OhNo itsJamie Talk 22:03, 20 May 2006 (UTC)
 * You didn't answer ! Alhoori 00:10, 21 May 2006 (UTC)
 * These are better than  http://www.alnaja7.org/Programmer/101/itcs_101.htm ?
 * Not to mention that the tutorial is very badly written, making dangerous, unportable and, what is most important, unnecessary assumptions about many things. I won't even go into the dreadful and overzealous colourisation. All in all, it would do more damage than good to a beginner in C. Denis Kasak 14:33, 6 June 2006 (UTC)


 * Essential C — Short C guide, great for programmers new to C.
 * Everything you need to know about pointers in C

External links arrangement
I am new to C, and I have come here to see this article just in order to learn C. I browsed trough the totorials, and the one that was the easiest to understand (and the most expanded too) was http://www.alnaja7.org/Programmer/101/itcs_101.htm, who appears the last and is not one of the 'recommended' totorials. (by recommended I mean that they are the last and they dont have any notes on them that say they are easy and good.) Well, what I want to say is that I think that section should be rearranged. (Sorry if I have any mistakes in my English.) —The preceding unsigned comment was added by Tapuzi (talk • contribs).


 * The easiest way to fix this is for you to move the links up and/or add some comments about the site / tutorials. Different people learn different ways, and what is a great tutorial for you might not be so for someone else (and vice-versa), so a brief description of the tutorials would be a help.  Also, your english was just fine. wrp103 (Bill Pringle) 13:35, 25 May 2006 (UTC)


 * It would probably be more beneficial to you, as a beginner, to stop reading such random tutorials from the 'net because there tends to be a high level of inaccuracy and erroneous information inside. The one you mention is particularly badly written. Instead, go to the library and grab a good book. There are a couple good recommendations in the article itself. Denis Kasak 14:45, 6 June 2006 (UTC)


 * Thanks for the advice. I borrowed a book from a friend which was pretty good, and now I can say that I know C. But from looking back to this toturial - I think that it doesn't miss any important point and also that its pretty much accurate. I admit that the book I read was hard, so I had to use some of my knowledge from this (http://www.alnaja7.org/Programmer/101/itcs_101.htm) tutorial in order to understand a bit of the book. So, in my opinion, this tutorial was and still is a good tutorial, and i think it should take place in this article. Tapuzi 11:18, 13 July 2006 (UTC)


 * I deleted this link. The person who made this page keeps inserting links to his own webpages into many articles. I'm not a complete expert in C, but I am in C++ and found that his C++ tutorial is riddled with errors and is of a generally poor quality. Having a quick look at the C tutorial: The classic problem, the data types page implies the size of char, short, int, long, etc. are fixed by the standard. That is wrong. Also RAND_MAX doesn't have to be at least 32767. I didn't look very hard, thats just two common mistakes. I'm not saying it's a bad tutorial, just it's not the best the net has to offer, and I believe it's important to keep the number of tutorial links to a very small number (personally, I'm not entirely convinced they should be there at all... but that's another story). Mrjeff 12:24, 13 July 2006 (UTC)
 * I just wanted to add to my previous post, I don't want that post to sound too negative, I'm always glad to see new people getting involved in wikipedia. However, I think it's more useful to spend time improving articles than linking to other people's websites. Mrjeff 12:28, 13 July 2006 (UTC)
 * According to Section 7.20.2.1 of the ISO C Standard "The value of the RAND_MAX macro shall be at least 32767." Mickraus 15:46, 23 January 2007 (UTC)

Article too long
This article needs to be broken down into parts - it is much too long. For example, the hello world example is unnecessarily long, and I think I will move the step-by-step explanation of it to a new page (perhaps there can be a hello world page, with multiple languages' examples on it). I've archived most of the content that was on this talk page, so I hope that the article can once again be improved upon with coordination. Fresheneesz 00:54, 3 June 2006 (UTC)


 * I agree, and as for the Java article, the criticism section should be in a separate article, this article just linking to it and providing only a synthesis of common critics about the language. It now just confuses the reader. I also find rather comic than the C# article has no criticisms section at all !! Hervegirod 09:44, 11 June 2006 (UTC)

Libraries Section
I'm concerned about the new section for libraries that was recently added. To begin with, the description was wrong, but also I'm concerned that it will make an already too long article even longer, with minimal benefit for the main article on C. I would suggest that a new article be started for C programming libraries and a link included in the "See also" section. wrp103 (Bill Pringle) 13:16, 3 June 2006 (UTC)

VB equivalent
Does one interpret the following C construct:

for(i=0; i<end; i++) { int c = array[i]+1-min; count[c]++;

in Visual Basic as:

for i=0 to end-1 c = array(i) + (1 - mim) count(c) = count(c) + 1 next i

...IMHO (Talk) 15:54, 3 June 2006 (UTC)
 * Yes, that looks like a fine translation. Deco 21:18, 17 June 2006 (UTC)
 * Except that 'min' should be used instead of 'mim' Mickraus 16:26, 24 January 2007 (UTC)

Featured article candidate: Forth
I have put Forth up as a featured article candidate. Please participate in discussing how it can be made to equal this article in quality. Ideogram 07:20, 4 June 2006 (UTC)

Featured article review
Can someone provide a link to the revision of the article that was featured, for comparison? (I know it's changed a lot since then, so I'd say some review is appropriate.) —Steve Summit (talk) 13:16, 23 June 2006 (UTC)


 * Actually, the main problem is lack of citations, for which standards have changed since the article was featured. Ideogram 17:17, 23 June 2006 (UTC)

System Programming Citation needed?
The assertion that C is the most common language for system programming was flagged as needing a citation. It seems so obvious to me, I'm not sure why anyone would think it needs a citation. Does anyone know another language that might be able to make that claim? wrp103 (Bill Pringle) 21:51, 11 July 2006 (UTC)


 * My guess would be that the only other contender (besides the debatably-separable C++) would be IBM System/360 through Z/OS Basic assembly language. I doubt there's another close contender, although X86 assembler must be right up there, at least if we're considering "programmed units sold".


 * Atlant 12:11, 12 July 2006 (UTC)


 * Indeed the original designers (K & R) developed C for the purpose of systems programming (Unix). Mainly for portability. The early C libraries were primarily system functions. &mdash;Pelladon 07:12, 4 August 2006 (UTC)

"Discarded" Operators?
"C ... was the language that orginally discarded well established operators such as and, or and = (for equality test)"

Is "discarded" the wrong verb? Is this referring only to the lexical tokens (operator symbols, not operators) used? Perhaps "replaced" would be better, and a mention of what replaced them: &&, ||, ==.

There could also be a clearer comment on why this relatively superficial syntactic issue is significant. Many successful recent languages have copied the syntax of C for logical expressions and assignment.

The meaning of this passage was not obvious to me at first reading, I am unsure if it is really about syntax and symbols. It will probably also be unclear to other (non-native-speaker English) readers, so it should be clarified one way or the other.

Fbkintanar 01:55, 26 July 2006 (UTC) Cebu City


 * I agree that the comment isn't that clear, especially since there were other languages that didn't use and and or as well (e.g., FORTRAN used .AND. and .OR.). What was significant, however, was the differentiation between equality and assignment, where C used the double equal sign to indicate equality, while many languages of the time didn't differentiate between the two uses.  The other significant thing that C did was implement both logical and bitwise and and or operators.  wrp103 (Bill Pringle) 03:09, 26 July 2006 (UTC)

The malloc example
I took out the malloc example again. It has a large number of problems, and is not really necessary anyways.

int *DynamicArray(int newSize) {  int *tbl;  /* will be a dynamic array */ tbl = malloc(newSize * sizeof(int)); /* allocate memory */ return tbl; /* tbl can be referenced like any array (e.g., tbl[i]) */ }

--Stephan Schulz 18:04, 26 July 2006 (UTC)
 * While I personally like CamelCase for some functions, this is unidiomatic for C.
 * The parameter should be a  for any function of this kind.
 * No check for NULL. Idiomatic C would be to directly write.
 * Since tbl can be NULL, the last comment is actually wrong.


 * Yeah, I was going to write only the first two lines, but got carried away and decided to write it as a function. I don't like CamelCase either, but the earlier examples on prototypes used it.  (I try to follow whatever stylistic standards already exist.)
 * I would like to see the code someplace, since there are few places that explain how to create dynamic arrays in C, and many of the text books I've had to use often claim it can't be done, soI have to keep correcting students' papers.
 * BTW - it doesn't have to check for NULL, since the caller should test for NULL to determine if the function worked. You are right about , I keep forgetting all the new-fangled stuff they've added to C. ;^) wrp103 (Bill Pringle) 19:52, 26 July 2006 (UTC)
 * Sure, but if you do not check for NULL, the function is kinda pointless ;-). And you cannot reference  if   is  .  If you want to preserve it, I would suggest to move a cleaned-up version into malloc. It does not really create a dynamic array anyways, just something that looks a lot like one (but then the newfangled C standard now allows real dynamic arrays in local scopes ;-). --Stephan Schulz 20:23, 26 July 2006 (UTC)
 * P.S.: Reading [news:comp.lang.c comp.lang.c] and [news:comp.std.c comp.std.c] is an excellent way to be exposed to any new features and any amount of language lawyering you can wish for. In fact, it's a bit like drinking from a firehose at first ;-).


 * Well, if the function checks for NULL, what would it do? You certainly don't want to terminate the program just because the system is low on memory.  Whoever calls a function that returns a pointer should always check for NULL, so the only reason you need to check for NULL is if you are going to dereference the pointer.  I have a friend who maintains it doesn't make sense to check for NULL, since it indicates the program is already in trouble, and will probably crash shortly anyway. ;^)
 * I know about all the new-fangled stuff; I just choose not to bother with them, unless I need to. ;^) Of course, several compiler vendors have made the same decision. ;^)
 * The fact that I had it in malloc and it was removed suggests it wouldn't last there, either. Oh, well, its in my lecture notes. wrp103 (Bill Pringle) 21:19, 26 July 2006 (UTC)

K&R vs ANSI/ISO parameter declarations
Hi,

the article states that the way K&R declared parameters and how ISO/ANSI do it is semantically equivalent. This is not quite true. While with the ANSI/ISO way the parameters are indeed passed as the types specified, in the K&R way the parameters are passed as ints and then converted to the types specified. This is required to have a unique way of passing parameters in assembly when there is no declaration. Remeber, in B everything was int. This gets important at those points where functions are called without the declaration of the function, essentially foobaring up everything. —The preceding unsigned comment was added by 84.176.241.74 (talk • contribs).


 * Actually when a prototype is not in scope the parameters are passed as promoted types, which include signed or unsigned int, signed or unsigned long int, (for C99 also signed or unsigned long long int), double, (for C89 also long double), structure, union, or a variety of (unaltered) pointer types. It doesn't make sense for the Wikipedia article to try to explain every detail, but if what it now has is badly misleading then it should be fixed.  Perhaps the two ways are "semantically similar, although for Standard C argument types are converted to match the prototype while without a prototype in scope argument types may be widened (to at least int or double)." — DAGwyn 05:58, 21 December 2006 (UTC)

Help the newbie
I found this on Wikibooks. int dividend = 50; int divisor = 0; int quotient;

if(divisor == 0) { // Handle the error here... }

quotient = (dividend/divisor);

// Handle the error here...

Handle the error with what code? Please help me. Thank you. --193.77.22.121 16:43, 27 July 2006 (UTC)

fprintf(stderr, "Division by zero attemted, report for termination\n"); exit(EXIT_FAILURE); ...or in other words, it depends on your application anf what you want to do with this code. --Stephan Schulz 16:48, 27 July 2006 (UTC)

Guidelines for Citations
What are the guidelines of when citations are required? The number of citations requested for this article seem silly to me, especially to those of us who have been working with C for a long time. For example, I've been using the term "portable assembly" for many years. Can I cite myself then? The comment about being available for a wide range of platforms is another one, and especially "probably more than any other language in existence". (Why do we need a citation for a "probably"?) Can somebody name another possible candidate for that statement? How many platforms are there that don't support C? I'm all for documenting sources, but this seems a bit much. I'm surprised somebody hasn't flagged the opening sentence as needing a citation. wrp103 (Bill Pringle) 16:06, 29 July 2006 (UTC)


 * :-O You don't understand citations at all ! Please read the introductions of Verifiability, No original research, ((Wikipedia:Neutral point of view)), Avoid weasel words and Scientific_method. Concerning your points: the term "portable assembly" is incorrect. The correct term is "mashed potatoes". I've been using it to refer to the programming language for many years, and all my friends use it too. Even my uncle has used the term before I was born to refer to C. Can I change it in the article and cite myself ? Also, the probability that C is more widely used is only 16,7%, as a Tibetan monk told me when I travelled to East Mongolia. So it's not that probable. The other candidate for that statement is χπτο, a language created by me, of course. Every country I go they are all using this language. The probability is around 65%, much higher than C, as my uncle told me. I'll cite a few platforms that don't run C. They are all Russian, so I don't know if you have used them:


 * ИЕИИОНКЛИДОДКПЕОИКЙЖНЗЙЛДПЖЛДЖТЙЗЗЕСИЛКМТМЕРИЖТМДЙ
 * ЖЖДЛЕДПЗЛПЙСМДЕНТРМРРЛРСРЕЛПЕДМИЖМЗОДТСТЗИРПИЙСОЖК
 * ТДКПЙОИЙККРЛЖКЛЙЕМРТЛДОЙЗЛОЕНЙДНЙСРЖМЖЛТМПСОЖКЛЗКП
 * ОСЗЙОЛИКДТЗЛДДЙРЖСТЖЙЛСЗНЕЕНИЛЙТКЕРММЕКДЛНМЛНЙЙРИИ
 * КНИИИЙЙККЖСРМПСЙЙСТПЙККЙТДППИЛДОЕПДЙНРЗДКЖИДЙЖРОЛЗ
 * ТЙЖЙОЕРСИНЙПИКМПИНЕЛНЛЕТТЛМИНМТМСЕЙДНОТСИИОМЗОРТИС
 * ССРДИИТСММСЛНПЕТЗОНЖНСТИТЖТПМОЕКМССЙЖРОЖСМЖЛПЗСТЙМ
 * ЖТСМОИЖЕЛОПМЕРТДЖМИРЗЖЙЙНЕДДЛЙМЕРСНЛОПНЖСРЗЛННТПНЗ
 * ДРСЙНТСНТСЛТТИСНЗМРИЖЗЖЙОЗКНЛЕИЛСЖЙДЖОЕЕММЕМИКНМКС
 * РДЕТСЗЗИИЖЙННПЗТПРЖИТОСЛОНЙИЖЗОДЗПКЕЛЕКПЗЗРЙТЕПЖСС
 * ТИНИЗПСММЕПЗМЛККМСМКОЗОЛМЕДЙПТЗООИТТМРЛЕЙПИСЗОРЗЕЙ
 * ОЗМЙЖНКЗТЖННИИКЗОТМОЛСКПИЕСЕИКСТНСПРТЗДСРЕДНРСРМИР
 * ЗПЗЕТЛЖРДСИЙСЙОНЖОИНДНОДЗДЙЛМНЙПРМРПЛКНТИЙПНОКПЙЕЛ
 * КЖЕННПНДПЖЕЕЙТЕНЖДДПКПМЖКПМЖМЖЕТИОМЙКНРЖЗТОМЙЗЖЛЗН
 * ПНКПЗИТРСЛТТТОНТДМНСЖРИЙКЕМДДИЖПЙМДНИТСЖЛИМКТЗЙКЗК

As you can see, there are thousands of architectures that don't support C. --hdante 16:18, 31 July 2006 (UTC)


 * Glad to see you have a sense of humor. Hopefully, somebody will answer my question.


 * Actually, "portable assembly" is my typo. The term I have been using is "high level assembly language," which pretty much conveys the same meaning.  I recall making that comment to Kernighan once, and he didn't contradict me, so I tend to think it is more accurate than "mashed potatoes".  ;^)


 * Just having a citation isn't always enough, BTW. I've been stuck with several text books that made incorrect statements about C, so citing them as a reference would be misleading.  As for NPOV, there are lots of topics where you can cite an article that is very POV.  It is also easy to get citations that contradict each other as well.  IMHO, the best way to guard against POV is many pairs of eyes and intelligent discussions.   wrp103 (Bill Pringle) 17:02, 31 July 2006 (UTC)


 * No, the Wikipedia standard is "Verifiability, not truth". If all the sources say that the world is flat, then Wikipedia must say that the world is flat, because asserting based on our knowledge that the world is round is Original Research.  The only way to draw the conclusion that a citation is incorrect is to do your own Original Research, which is not allowed.  If citations contradict each other, we include both sides.  NPOV doesn't mean no point of view, it means we report the major points of view without judging which is correct.  --Ideogram 20:49, 31 July 2006 (UTC)