Talk:Union type
| This article is rated C-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
union
[edit]This article seems to suggest that it is possible to have methods, static members, private and protected methods, and probably a few other things that I am forgetting, In C++ unions. As far as I know this is not the case, but I am not 100% certain of this. Can someone clarify in the article what features of structs are not possible for unions in C++.--King Mir 18:31, 29 April 2007 (UTC)
- Static data members are allowed since C++11. Methods has always been allowed. 90.230.55.237 (talk) 09:50, 25 November 2019 (UTC)
Misconception
[edit]When you talk about union types, the first thing that pops up is the unions from C/C++, but there is such thing in the type theory of programming languages. Don't have any paper on hand, but the Types and Programming Languages by B. Pierce describes the intuitions, which is much general that it is in the current page [1] — Preceding unsigned comment added by Hfehrmann (talk • contribs) 23:15, 19 December 2016 (UTC)
References
At most one member of a union can be active at any time
[edit]The section about C/C++ states: "The primary use of a union is allowing access to a common location by different data types, for example hardware input/output access, bitfield and word sharing, or type punning." This usage might be common but is not actually guaranteed to work according to the standard. I think it should at least be mentioned that this is either undefined behaviour or relying on extra guarantees given by the compiler. 90.230.55.237 (talk) 09:35, 25 November 2019 (UTC)
Scala 3 union types
[edit]I think Scala 3 union types should be mentioned somewhere, but if I understand correctly, they are neither union types nor tagged unions... Any ideas? — Chrisahn (talk) 18:46, 21 August 2022 (UTC)
India Education Program course assignment
[edit]
This article was the subject of an educational assignment at College Of Engineering Pune supported by Wikipedia Ambassadors through the India Education Program during the 2011 Q3 term. Further details are available on the course page.
The above message was substituted from {{IEP assignment}} by PrimeBOT (talk) on 20:06, 1 February 2023 (UTC)
Left/right alignment of pointers
[edit]I am not going to bother starting an RfC for this one, because there already are two others on the same topic on other pages and that would just be tedious. Instead I am going to just leave a talk section. I propose that on the section regarding structs and unions in C/C++, we use left alignment for asterisks on pointers. The reason is that it is a section on both C and C++, and left alignment is essentially dominant in C++ whereas in C left and right have a more even split. Furthermore, left alignment places the focus on the type of the variable, for example char* s; suggesting s is a pointer to a char, rather than *s having type char. This is consistent with the compiler which will parse s as having type char*. The only arguments in favour of right alignment I have heard are that it is dominant in older (C specific) style guides, but it is once again a section on both C/C++. The full extent of my arguments can be found on Talk:Pointer (computer programming) and Talk:C data types. 2605:8D80:1391:EE1E:39B2:8822:ED56:E98E (talk) 15:36, 23 October 2025 (UTC)
- "I am not going to bother starting an RfC" – that's a good call because a request for comment is not the first option for dispute resolution, especially between only two editors. See WP:RFCBEFORE. Yue🌙 18:59, 23 October 2025 (UTC)
- C-Class Computer science articles
- Mid-importance Computer science articles
- WikiProject Computer science articles
- C-Class Computing articles
- Low-importance Computing articles
- C-Class software articles
- Mid-importance software articles
- C-Class software articles of Mid-importance
- All Software articles
- All Computing articles
- India Education Program student projects, 2011 Q3
- India Education Program student projects
