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 |
Daily pageviews of this article
A graph should have been displayed here but
graphs are temporarily disabled. Until they are enabled again, visit the interactive graph at
pageviews.wmcloud.org |
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. |
C has system facilities. Any language with low-level facilities should not be use for general-purpose programming. It bakes in dependencies, results in lock in (which C does), and also results in inflexibility.
C also has many primitive facilities like pointers and defines which really have no place in general-purpose programming. Ian.joyner ( talk) 20:12, 13 May 2023 (UTC)
C is a general-purpose programming language." (page 1; also a near identical sentence is in the preface on p. xi).
In the "overview" section, under "User-defined (typedef) and compound types are possible" Unions are mentioned as "Union is a structure with overlapping members; only the last member stored is valid."
This is not a fair or accurate statement according to the C standard. I believe this may have been written confusing the C standard for the C++ one, in which accessing a union member that was not most recently written to is strictly undefined.
The C standard explicitly allows "type-punning" using unions, but carefully promises that reinterpreting the bit-representation of one type to another may result in an invalid or trap representation.
The following is pulled directly from the C17 standard. It lies in a footnote under section 6.5.2.3.3:
"If the member used to read the contents of a union object is not the same as the member last used to store a value in the object, the appropriate part of the object representation of the value is reinterpreted as an object representation in the new type as described in 6.2.6 (a process sometimes called “type punning”). This might be a trap representation."
The mention of unions should probably be edited to something like "Union is a structure with overlapping members; it allows multiple data types to share the same memory location".
I will leave this note here for a few weeks and if no one objects I will make the edit. WillisHershey ( talk) 21:28, 25 September 2023 (UTC)
Rather 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)
return
leads to a warning - except in main()
, 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)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.
Jochen Burghardt removed this section on C allowing various memory allocation implementations:
C permits the use and implementation of different memory allocation schemes, including a typicalmalloc
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)
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)
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 its malloc
- the others do not - and indeed there is already a link in the debated section to
C dynamic memory allocation.There 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)
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 |
Daily pageviews of this article
A graph should have been displayed here but
graphs are temporarily disabled. Until they are enabled again, visit the interactive graph at
pageviews.wmcloud.org |
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. |
C has system facilities. Any language with low-level facilities should not be use for general-purpose programming. It bakes in dependencies, results in lock in (which C does), and also results in inflexibility.
C also has many primitive facilities like pointers and defines which really have no place in general-purpose programming. Ian.joyner ( talk) 20:12, 13 May 2023 (UTC)
C is a general-purpose programming language." (page 1; also a near identical sentence is in the preface on p. xi).
In the "overview" section, under "User-defined (typedef) and compound types are possible" Unions are mentioned as "Union is a structure with overlapping members; only the last member stored is valid."
This is not a fair or accurate statement according to the C standard. I believe this may have been written confusing the C standard for the C++ one, in which accessing a union member that was not most recently written to is strictly undefined.
The C standard explicitly allows "type-punning" using unions, but carefully promises that reinterpreting the bit-representation of one type to another may result in an invalid or trap representation.
The following is pulled directly from the C17 standard. It lies in a footnote under section 6.5.2.3.3:
"If the member used to read the contents of a union object is not the same as the member last used to store a value in the object, the appropriate part of the object representation of the value is reinterpreted as an object representation in the new type as described in 6.2.6 (a process sometimes called “type punning”). This might be a trap representation."
The mention of unions should probably be edited to something like "Union is a structure with overlapping members; it allows multiple data types to share the same memory location".
I will leave this note here for a few weeks and if no one objects I will make the edit. WillisHershey ( talk) 21:28, 25 September 2023 (UTC)
Rather 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)
return
leads to a warning - except in main()
, 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)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.
Jochen Burghardt removed this section on C allowing various memory allocation implementations:
C permits the use and implementation of different memory allocation schemes, including a typicalmalloc
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)
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)
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 its malloc
- the others do not - and indeed there is already a link in the debated section to
C dynamic memory allocation.There 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)