Talk:C (programming language)
This is the talk page for discussing improvements to the C (programming language) article. This is not a forum for general discussion of the article's subject. |
Article policies
|
Find sources: Google (books · news · scholar · free images · WP refs) · FENS · JSTOR · TWL |
This level-4 vital article is rated C-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
C (programming language) is a former featured article. Please see the links under Article milestones below for its original nomination page (for older articles, check the nomination archive) and why it was removed. | ||||||||||||||||
| ||||||||||||||||
Current status: Former featured article |
C Intermediate Language was nominated for deletion. The discussion was closed on 29 April 2013 with a consensus to merge. Its contents were merged into C (programming language). The original page is now a redirect to this page. For the contribution history and old versions of the redirected article, please see its history; for its talk page, see here. |
|
|||||||||||||||||
This page has archives. Sections older than 100 days may be automatically archived by Lowercase sigmabot III when more than 4 sections are present. |
improving the "hello world" example
editRather than an blind "afaik", a reliable source is needed to alter an example which has a valid reliable source. 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
return
leads to a warning - except inmain()
, so Tedickey is right. As a side remark, I don't see a source given for the 2nd version. - Jochen Burghardt (talk) 10:21, 22 October 2023 (UTC)
- Quoting from ISO/IEC 9899:1999(E), section 5.1.2.2.3 Program termination:
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.
- Perhaps C11 changes that, but again, a WP:RS helps 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 TEDickey (talk) 15:35, 22 October 2023 (UTC)
Mention of C allowing various memory allocations schemes
editJochen Burghardt removed this section on C allowing various memory allocation implementations:
C permits the use and implementation of different memory allocation schemes, including a typical
malloc
andfree
; a more sophisticated mechanism with arenas; or a version for an OS kernel that may suit DMA, use within interrupt handlers, or integrated with the virtual memory system.
With the edit summary "malloc is not built in in C, but a library function, and could be provided for every other language in a similar way"
. It's actually not true that you can do this in every other language, it depends on directly manipulating and storing pointers for one thing, which most languages do not do. The passage doesn't say malloc is part of C itself, in fact it implies the opposite - it lists malloc as one possibility. I disagree with this removal. —DIYeditor (talk) 19:49, 7 November 2023 (UTC)
- As I understand the title of this article, it is about the C programming language itself; there is a different article C standard library. "
The passage doesn't say malloc is part of C itself
" - this is the reason why I think it shouldn't be discussed here, but at C standard library. As a side remark,malloc
can be implemented as is in every language that supports pointers, and with slight modifications in every language that supports arrays (having arbitrary type casts in the language will increase user convenience). - Jochen Burghardt (talk) 11:58, 8 November 2023 (UTC)- Please stop edit warring to restore your preferred version.
- We can wait for input from more people. —DIYeditor (talk) 13:17, 8 November 2023 (UTC)
- I didn't edit C (programming language) after my above reply. The anonymous IP 193.162.48.193 vandalized an article part that is unrelated to our above discussion, and I assure that it wasn't me. Admittedly, my 2nd revert might have violated a strict interpretation of WP:BRD; however, I gave a long justification in my edit summary. Waiting for opinions from other people is ok for me. - Jochen Burghardt (talk) 14:05, 8 November 2023 (UTC)
- The goal of this the overall section is to explain and justify the wide adoption of C as a systems programming language. The section in question states that C permits choice in dynamic memory allocators - a good justification, since operating systems and similar often control memory for other processes. Options range from the usual
stdlib.h
to very machine-specific ones. This flexibility is a feature of the language. Only one of the choices pertains to the standard library and itsmalloc
- the others do not - and indeed there is already a link in the debated section to C dynamic memory allocation. - If there are improvements to be made, then let's make them! But I agree with DIYeditor and disagree with the removal. Chumpih t 20:18, 8 November 2023 (UTC)
Duplicate sections on related languages - merge?
editThere appears to be two similar sections in the main article: Relations to other languages and Related languages. Former is a list within the Overview section; latter is an exposition on the influence of C, sitting near the end of the article.
Should we consider these as duplicates, and merge them to one location? Or are we happy with the different emphasis on the somewhat similar content, and leave well alone? Or Perhaps replace the first section with a sentence and keep the latter section? Or something else? Chumpih t 05:29, 26 April 2024 (UTC)
C is a compiled language
editA compiled language is "typically" compiled according to Wikipedia. I would like to add "compiled" to describe C. In fact, C is one of the most common languages, if not the most common language, cited as an example of a compiled language. Chris.temp.level.0 (talk) 13:27, 17 July 2024 (UTC)
- @Vincent Lefèvre and Jkudlick: The issue seems to be this edit which inserted "compiled" before "general-purpose programming language" in the lead. Per WP:LEAD, information in the introduction should be a summary of what is in the body of the article and it looks as if one reason given for a revert was doubt about whether the information is in the body. Bear in mind that the lead already refers to "compile" in a couple of places: "C compilers" + "designed to be compiled" + "can be compiled". People like fiddling and Google tells us that C interpreters exist although of course if the term "compiled language" has any meaning, it certainly applies to C. Johnuniq (talk) 01:43, 18 July 2024 (UTC)
- @Johnuniq, Chris.temp.level.0, and Vincent Lefèvre: I was only involved insofar as this article has pending changes protection and I happened to review a pending change that had already been reverted. As I stated on my talk page, I would have accepted the edit if it had not already been reverted. I am glad to see Chris has engaged in discussion here to reach consensus, and I will leave the discussion to those with much better knowledge of this subject than me. — Jkudlick ⚓ (talk) 23:29, 18 July 2024 (UTC)
- @Jkudlick, Johnuniq, and Chris.temp.level.0: I think that "designed to be compiled" already present in the LEDE is sufficient. — Vincent Lefèvre (talk) 12:00, 20 July 2024 (UTC)
- Agree. Chumpih t 14:34, 20 July 2024 (UTC)