Jump to content

Talk:C (programming language)/Archive 16

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Archive 10Archive 14Archive 15Archive 16Archive 17

Semi-protected edit request on 24 October 2015

About the "Typing discipline", The weak typing is not a precise definition. So, please remove it. 36.229.47.121 (talk) 12:04, 24 October 2015 (UTC)

That typing is not enforced, is a significant characteristic of the language, so I think it should be mentioned but maybe its the term you're objecting to. It makes sense to me. See Strong and weak typing. What makes you think it's not a precise definition? How would you word it? The Dissident Aggressor 14:46, 24 October 2015 (UTC)
(ec) It is, however, how the language is commonly described. Also, what would you suggest as the alternative - type safety is a spectrum, and C falls on the "less strict" end of that spectrum, but calling it generically "not type safe", while having a more precise definition, seems less helpful. Rwessel (talk) 15:25, 24 October 2015 (UTC)
And I don't think this article is protected (semi, or otherwise). Rwessel (talk) 15:27, 24 October 2015 (UTC)

The content of the external link "A History of C, by Dennis Richie, archived from the original on February 2, 2004" is unavailable. — Preceding unsigned comment added by Vitor.Alcantara.de.Almeida (talkcontribs) 13:10, 4 December 2015 (UTC)

Fixed. Thanks! - Richfife (talk) 16:57, 4 December 2015 (UTC)

Inconsistency regarding relationship with ALGOL

From the Data Types section:

The type system in C is static and weakly typed, which makes it similar to the type system of ALGOL descendants such as Pascal, although C is unrelated to ALGOL.[28]

The assertion that C is unrelated to ALGOL is incorrect in a number of ways, and there are cited mentions of ALGOL's influence on C elsewhere. I would recommend phrasing something like this:

The type system in C is static and weakly typed, which makes it similar to the type system of ALGOL and its descendants such as Pascal.

I checked the citation, and it supports the assertions made about the type system but not the assertion that C is unrelated to ALGOL. It does mention that C is related to B and BCPL; in fact BCPL is a subset of CPL, which was more or less an extension of Algol.

98.202.130.141 (talk) 11:12, 6 January 2016 (UTC)

I agree. I've gone ahead and made the change. Rwessel (talk) 20:03, 6 January 2016 (UTC)

C language

C is the programming language ,which is the base of c++,JAVA , and other opp programming language . C cant create a program it is only for a knowledge Wjrbvek (talk) 11:24, 2 April 2016 (UTC)

@Wjrbvek: Sorry, that's pretty incomprehensible. Are you suggesting a change in the article? Rwessel (talk) 23:53, 2 April 2016 (UTC)

Semi-protected edit request on 1 April 2017

In the ANSI C and ISO C section, here is a reference to the Normative Amendment 1: https://www.lysator.liu.se/c/na1.html Lovelace42 (talk) 23:08, 1 April 2017 (UTC)

Not done: According to the page's protection level you should be able to edit the page yourself. If you seem to be unable to, please reopen the request with further details. 80.221.152.17 (talk) 21:06, 5 April 2017 (UTC)

Nonsense in this article

This article says:

"Nearly a superset of C, C++ now supports most of C, with a few exceptions."

Guys, what kind of bu.llcr.ap is this? This statement suggests the compatibility improves over time and that it is a design goal of C++.

This may have been historically true, but now the ways of both languages part more and more nowadays! A non-exhaustive list of features of C introduced in C11 or even C99 deliberately not supported by C++: • struct initialization with designators, • restrict type qualifier, • bounds-checked functions, • thread support (C++11 added threading support, but with a different API!), • VLAs, etc, etc!

Also see this thread in the ISO C++ Standard - Discussion mailing list to see how very wrong you were.

Fix this article!, Okay? — Preceding unsigned comment added by 89.77.194.225 (talk) 16:14, 23 May 2017 (UTC)

Some comments

I have decided to use this page (and no other) for advice (in or out..). I have removed a message from my talk-page, and since the user is more Wikipedia-experienced, compared to my initial thought's , do I suggest he do the same at his talk-page. Nothing fruitful to find there, I conclude.

I'm please to see the constructive will that has emerged here, regarding the design of the C-language. One minor objection about the headerfiles. These are found in in the (API), which is a part of the standard library - but the non-prepared headerfiles are usually stored elsewhere. (No software company, want's to "discover the wheel" again, time after time - and do often build up headerfiles of their own - and they may also purchase and sell headerfiles, as well. Non originally included hearderfiles becomes usually not located together with the included ones, and becomes (if so) included like below:

"#include "c:\pathway\own_headers\own_string_header.h" " (quotation marks just used once - # becomes a number)

But the can also be located in normal the "Application Programming Interface", if this is found necessary or suitable. And can if that's the case be included "normally"

"#include <own_string_header.h> " (without any quotation marks, here only due to # )

Also edit of headerfiles can be done, but that topic is perhaps outside the article's scope.

Here is , just by the way , the file I used originally https://sv.wikipedia.org/w/index.php?title=C_(programspr%C3%A5k)&action=edit&section=32 Boeing720 (talk) 07:43, 8 July 2017 (UTC)

The KR&C example

Shouldn't (at least a code.c meant for C-compilation rather than c++ compilation - if it matters at all)

register /* int */ test2;
be
register int test2; ?
Just "register, auto, volatile" etc calls for a type following !??
I'm a bit confused here, without any c-compiler at hand

Boeing720 (talk) 12:51, 9 July 2017 (UTC)

Recent edits

Any suggestions on what should be done with the recent changes to C (programming language)#Design? The text on keywords needs to be removed as it duplicates C (programming language)#Reserved words and uses language that is too informal. The text about functions and subroutines is not needed. The wording about math.h, for example, needs to be omitted or fixed so as to not give the impression that math.h provides the functions (in fact, the functions can be used without any mention of math.h). The text about building a collection of functions is again too informal, and is misleading regarding header files. Is any of the new text needed? Johnuniq (talk) 04:44, 19 July 2017 (UTC)

I've made a (dramatic) change to the section that I think addresses your concerns. Power~enwiki (talk) 05:00, 19 July 2017 (UTC)
Johnuniq and Power~enwiki: Thank you guys. I have a lot of concerns about all the edits Boeing720 has made, for example: [1][2][3][4][5]. He seems to be a non-native English speaker and perhaps novice at C programming (or it is impossible to tell whether it is more of an English or C related problem) who is determined to leave a mark on this article at any cost and I am at wits end trying to deal with his edits. Have felt like I am doing it alone. Eyes could also be used at Register (keyword) and Talk:Register (keyword). Really trying to be constructive, collaborative and cooperative but am getting worn thin. —DIYeditor (talk) 05:19, 19 July 2017 (UTC)
I'm no novice in English nor C. I have a university-level embedded programming exam. There are English self-tests all people can do, in order to see at which level one might study the English language further (for natives or others). I have scored up to the highest possible level on all I've done (four). DIYeditor must either be a beginner here at Wikipedia, or - and perhaps more likely some kind of troll or similar. In one year have you written two stubs, the rest of your time here do you appears to ... - well - be doing what are doing. (I had a fairly good look in your statistics)
However - The main problem with this article is the entire layout. I believe we should follow the same general layouts, as most authors in the subject do. I should be about the C-language , not the C++ language, the different standards (European as well as American) are of minor interest - at least until other matters are solved. And as I tried to explain, a new standard is not like a new speed limit. It's voluntary.
  1. What is the C-language (and we have a certain comparing with other languages, but it's wrong to begin with comparison before the matter is properly explained.
  2. What is its use ? Has it a primary use ?
  3. Structure (preprocessor, keywords, headerfiles, functions , arithmetics etc)
  4. Easy code examples
  5. Embedded programming
And so on. And if one just happens make an linguistical error in any sense, should that be corrected without mocking — Preceding unsigned comment added by Boeing720 (talkcontribs) 06:26, 19 July 2017 (UTC)
Sorry, but Wikipedia is not a gentle place. Text that is helpful is welcome, however if consensus judges other text to be unhelpful, it will be removed or drastically refactored. The first sentence above is "I'm no novice in English nor C". The "nor" is wrong—it should be "or". The second sentence is missing a word, possibly "passed". The purpose of this section was outlined in the OP (opening post—that is, my first comment). It's fine to raise other points, but when the OP has not been addressed, the other points may not be helpful here, and may be ignored. Johnuniq (talk) 07:35, 19 July 2017 (UTC)
At talk-pages have I not really experienced the language issue to be of extreme importance. I could equally have written "I'm no novice in English nor in C". The article must be the primary issue. And in that lies "well written" as a part, naturally. I have added a c-code (with some difficulties due to Wikipedia's own syntax) which I think is enlightening from various aspects - like file handling and parameters to the program, some string handling and a little rather easy math. All in one file. It's also a usable PC program. (not overwhelmingly, but still) I would guess that at university level would it be of "middle difficulty" after perhaps two weeks of studies. Please forgive me if you also are educated or autodidact (of which there are not so few, still) in C, C++ or any other computer language. That other person clearly was not. So please accept my apologies, if this is the case. The code is not really intended for our readers, but parts may be. It's my hope that the code is inspirational, or later may become so. Boeing720 (talk) 14:39, 19 July 2017 (UTC)
And since I now have had a look at your personal page, can I see that there indeed was a call for my apology. I still don't know what or which languages you prefer. But just by the brief look (that) I had at your personal page, (did) it become obvious to me that you are, at the very least, familiar with "C-alike-code". Splendid ! Perhaps are you the contributor who can tidy up this article and give it (a) proper structure. And for instance clear up the "C vs C++ issue(s)", also from a historical background. Likewise ought the C-language first be explained properly, quite possibly including some differences towards C++. But all the different standards, like ANSI 89, C99 etc, shouldn't be brought up until after the essential parts are dealt with, should they ? Like I told another contributor, new standards are not like new speed limits. New standards are not automatically included in every development studio. I sincerely hope (that) you can help us to tidy up, and give the article a much better structure. Boeing720 (talk) 18:19, 19 July 2017 (UTC)

Hello fellow Wikipedians,

I have just modified one external link on C (programming language). Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}} (last update: 5 June 2024).

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

Cheers.—InternetArchiveBot (Report bug) 20:05, 28 July 2017 (UTC)

Semi-protected edit request on 21 August 2017

Could you change the helloworld program example to :


  1. include <stdio.h>

int main (void) {

   printf("hello, world!");
   return 0;

}

This is more proper and standard. Leechr1245 (talk) 14:15, 21 August 2017 (UTC)

Why? Why do you want to lose the newline? Are you aware that a 0 return is implicit, and standards-compliant to not state it? Andy Dingley (talk) 14:20, 21 August 2017 (UTC)
Not done: per Andy. jd22292 (Jalen D. Folf) (talk) 18:57, 21 August 2017 (UTC)

thousands of these sorts of tools

A recent edit commented "there's got to be thousands of these sorts of tools -- no reason to identify any one." while reverting a recent edit I made.

If so, I agree that this C (programming language) should not specifically name one specific tool, and certainly should not list 1000 or so tools, but I feel that the article *should* link to some other Wikipedia article that says some general words about those sorts of tools.

Is there a name for these sorts of tools? What Wikipedia article(s) discuss these sorts of tools? --DavidCary (talk) 13:40, 11 September 2017 (UTC)

The clue was in your edit: Lint (software), leads to ''Category:Static program analysis tools'', and then to List of tools for static code analysis (which, like all Wikipedia list-of pages should contain pointers to notable topics TEDickey (talk) 23:38, 11 September 2017 (UTC)
Dear TEDickey, many people believe that in every Wikipedia list-of page, "Every entry [should meet] the notability criteria", but the WP:LISTCRITERIA guideline specifically states that is not necessary for inclusion.
Thank you for telling me about the List of tools for static code analysis article, which I found useful.
However, if I'm reading that article correctly, that article focuses on executable tools that automatically check source code for "suspicious constructs", but that article doesn't really say any general words about such "sets of such suspicious constructs".
That article briefly mentions 4 published "sets of such suspicious constructs" that some of those tools check against -- MISRA, CERT, Common Weakness Enumeration, and "Google's style guide".
The Lint (software) article briefly mentions 5 or so particular such suspicious constructs, and implies that each one of such lint-like tools checks against one or more "sets of such suspicious constructs", but as far as I can tell that article doesn't even hint that human-readable published "sets of such suspicious constructs" exist.
If there really are thousands of such published "sets of such suspicious constructs" -- things like MISRA, CERT, Common Weakness Enumeration, and "Google's style guide" -- I still feel that this "C (programming language)" article should link to some other article that says some general words about those sorts of things.
Is there a general name for such "sets of such suspicious constructs"?
What Wikipedia article(s) discuss these sorts of tools? --DavidCary (talk) 17:03, 16 September 2017 (UTC)

Long Example code removed

This might be worth studying. A simple one file code, with a certain use. Program reads any file and reads each byte. (the value of each byte). It also sums up the bytes, measure the input file's length and "density". Well "density" is the same as average value of the bytes. (But some file types contain lots of zeroes, that's why I called it "density".) The code can be compiled on any c-compiler and should hence end .c .I called it binread.exe and the code binread.c . Remember to compile for the CMD-window. A complied file should be stored in the PATH, and can then be used from anywhere - on a command line or through start-> run. Syntax is "binread anyfile.any " or "binread anyfile.any DEC/HEX/LEN/DENS". Strange as it may sound is the program itself counted as an input file, so the input parameters are one or two (but counted as two or three). It's possible conio.h isn't needed, but compile first as it is, just to be safe. This was written many years ago now. A good usage is MP3-files , if any value changes (from before one play, to before another- and if the sum changes, examine the file further with a malware explorer.) Also note - some files must change ASCII-sum. But MP3's shall not!

Extended content

#include <stdio.h> /* BINREAD.C */ #include <stdlib.h> /* Reads any file binary, output sum of all bytes, length and average - all or one of them */ #include <ctype.h> /* depending on input */ #include <string.h> #include <conio.h>


int main (int argc, char* argv[]) {

  FILE *fil;                                                  /* "fil" is input file to read */
  long LOF;
  long i;
  long n=0;
  long sum=0;
  float dens;
  unsigned int c;
  /*-------------------------------------------------------------*/
  
  if ((argc < 2)||(argc>3))                                    /* two or three parameters are OK */
  {
     printf("Syntax: BINREAD filnamn.ext [LEN/DEC/HEX/DENS]"); /* Syntax & Message if this is wrong */
     exit (0);                                                 /* pos. third LEN DEC HEX DENS gives that value only */
  }
  /*-------------------------------------------------------------*/
  fil=fopen(argv[1],"rb");                                     /*  open for read-binary */
  if(fil==NULL)
  {
     printf("Error, can't open file !") ;
     exit(1);
  }
  /* ------------------------------------------------------------*/
  fseek(fil,sizeof(char),SEEK_END);                             
  LOF=ftell(fil)-1;                                           /* lengt of file */   
  rewind(fil);
  for(i=0;i<LOF;i++)                                          /* loop through the open file */ 
  {
     fread(&n,1,1,fil);                                       /* read byte -> n */
     sum+=n;                                                  /* tally */
  }
  fclose(fil);
  
  dens=(float)sum/(float)LOF;                                 /* "density" or average byte value */
  if(argc==2)                                                 /* output with two inputs */
  {
     
     printf("Binread %s\n",argv[1]);
     printf("dec: %ld   hex: %lX  \n",sum,sum);
     printf("Length: %ld bytes\n",LOF);
     printf("Density: %10.3f ",dens);                         /* decimal and hexadecimal sum, length & average or"density" */
  }
  if (argc==3)                                                /* output with three inputs */
  {
    for(c=0;c<strlen(argv[2]);c++)
    argv[2][c]=toupper(argv[2][c]);
    if(strcmp(argv[2],"HEX")==0)
    {
      printf("%lX",sum);					 /* decimal and hexadecimal sum, length & average or"density" */
    }
    if(strcmp(argv[2],"DEC")==0)                                /* output of the chosen value only */
    {
      printf("%ld",sum);
    }
    if(strcmp(argv[2],"DENS")==0)
    {
      printf("%10.3f",dens);
    }
    if(strcmp(argv[2],"LEN")==0)
    {
      printf("%ld",LOF);
    }
  }
  return 0;

}

Boeing720 (talk) 13:42, 19 July 2017 (UTC)

This is far too much code for this article. This is an encyclopedia, not a tutorial. Power~enwiki (talk) 19:45, 19 July 2017 (UTC)

I do fully agree, but it's still a tiny code for a complete program. Please read my two last comments under the headline "Recent edits". Boeing720 (talk) 11:04, 20 July 2017 (UTC)

@Power~enwiki: @Johnuniq: Boeing720 is at it again at Register (keyword) (an article he created which required considerable cleanup and pulling of teeth). He has introduced a really horrible (to be polite) piece of example code purporting to show the difference in performance between declaring register or not. Please see discussion at Talk:Register (keyword)#Example disproves. —DIYeditor (talk) 03:44, 10 February 2018 (UTC)

That's on my watchlist and I agree with the removal, and will follow-up in due course. Johnuniq (talk) 06:39, 10 February 2018 (UTC)

Security references missed

Probably some reference about security techniques such as format string vulnerability will be useful. — Preceding unsigned comment added by 201.175.133.12 (talk) 02:32, 30 March 2018 (UTC)

sum of two numbers

 #include<stdio.h>
 int main()
 {
  int a, b, sum;
  printf("\nEnter two no: ");
  scanf("%d %d", &a, &b); 
  sum = a + b; 
  printf("Sum : %d", sum); 
  return(0);
 }

— Preceding unsigned comment added by 119.235.51.254 (talk) 08:28, 3 October 2018‎

This is not a WP:FORUM for discussing C. That program has no real use as an example for this article. —DIYeditor (talk) 19:43, 3 October 2018 (UTC)

Semi-protected edit request on 3 October نصب برنامه YouTube2018

83.123.150.173 (talk) 20:29, 3 October 2018 (UTC)
->}} 83.123.150.173 (talk) 20:29, 3 October 2018 (UTC)

 Not done: it's not clear what changes you want to be made. Please mention the specific changes in a "change X to Y" format and provide a reliable source if appropriate. cymru.lass (talkcontribs) 22:23, 3 October 2018 (UTC)

Edit request: Rewording of Syntax section introduction for concision and clarity.

1.

Original:

"Line endings are generally not significant in C; however, line boundaries do have significance during the preprocessing phase."

Proposed change:

"Line endings are generally insignificant in C, but line boundaries are important during the preprocessing phase."

Comment:

'not significant' -> 'insignificant' (concision)

unnecessary 'however' forced cohesion

2.

Original:

"Function definitions, in turn, contain declarations and statements."

Proposed change"

"Function definitions contain declarations and statements.

Comment:

Not sequential order, redundant 'in turn'

Willexan (talk) 13:25, 11 November 2018 (UTC)

NB programming language listed at Redirects for discussion

An editor has asked for a discussion to address the redirect NB programming language. Please participate in the redirect discussion if you wish to do so. signed, Rosguill talk 21:20, 9 May 2019 (UTC)

"C (programming langauge)" listed at Redirects for discussion

An editor has asked for a discussion to address the redirect C (programming langauge). Please participate in the redirect discussion if you wish to do so. Steel1943 (talk) 20:10, 11 November 2019 (UTC)

an error seems to have occurred. — Preceding unsigned comment added by 0C70 PR0 (talkcontribs) 18:25, 10 December 2019 (UTC)
There is no error. Please perform test edits at Wikipedia:Sandbox, or, if you are referring to the red link above, clicking the red link displays a message indicating that the page was deleted as a result of the discussion also linked above. Johnuniq (talk) 22:31, 10 December 2019 (UTC)

Assuming wrong info about object files used

Based on https://en.wikipedia.org/w/index.php?title=C_(programming_language)&diff=930371741&oldid=930367380&diffmode=source

User @Fbergo reverted addition of object files in file extension:

Reverted redundant and incorrect info (object files are language-agnostic)[1]

Based on wikipedia language-agnostic is:

Language-agnostic programming or scripting (also called language-neutral, language-independent, or cross-language) is a software development paradigm where a particular language is chosen because of its appropriateness for a particular task (taking into consideration all factors, including ecosystem, developer skill-sets, performance, etc.), and not purely because of the skill-set available within a development team.[2]

@Fbergo: Elaborate why is this not relevant to https://en.wikipedia.org/wiki/C_(programming_language) assuming that said object files are generated by a compiler (GCC) and used in C programming. --Kreyren (talk) 11:37, 12 December 2019 (UTC)

References

  1. ^ "User:Fbergo", Wikipedia, 2018-11-20, retrieved 2019-12-12
  2. ^ "Language-agnostic", Wikipedia, 2018-07-14, retrieved 2019-12-12