23

After a quick search in draft N4296, I could not find any example of a name in the C++ Standard Library for which two possible spellings exists (BrE vs. AmE).

While this may even be intentional, I can imagine that at some point, if a graphics library will be standardized (and there seems to be some effort going in this direction), the choice between "colour" and "color" will have to be made.

Are there normative regulations or perhaps even informal criteria that are being used to decide which spelling to pick for names in the C++ Standard Library?

Camilo Martin
  • 37,236
  • 20
  • 111
  • 154
Andy Prowl
  • 124,023
  • 23
  • 387
  • 451
  • 10
    `xsputn` would imply it's neither. – R. Martinho Fernandes Mar 28 '15 at 17:36
  • I have seen/found things universal english i.e. they are common to both UK/US English in C++ STL. `tokenize` is something I always thought was pushed using US English...But where are you going with this? i.e. what is the key point for this question? – ha9u63a7 Mar 28 '15 at 17:45
  • @ha9u63ar: There is no `tokenize` in the C++ Standard Library AFAIK – Andy Prowl Mar 28 '15 at 17:46
  • 2
    @ha9u63ar: What do you mean "what is the key point"? Is the question not clear? Why does it have to "go" anywhere? – Lightness Races in Orbit Mar 28 '15 at 17:47
  • @AndyProwl my bad...switched my brain from Java... – ha9u63a7 Mar 28 '15 at 17:47
  • 14
    `uninitialized_copy` would seem to set a precedent for the US variant. (Although the "z" is technically correct, if abominable, in English). – Mike Seymour Mar 28 '15 at 17:48
  • @LightnessRacesinOrbit I am trying to understand how a standard english spelling issue for a HL language library is impacting users.....just a question.... – ha9u63a7 Mar 28 '15 at 17:49
  • 4
    @ha9u63ar: The reason I asked is that I was trying to come up with a name for a function in my codebase and I had to pick a spelling. For consistency, I thought I'd do like the Standard Library does, but I could not figure out what the Standard Library does. Hence the question... – Andy Prowl Mar 28 '15 at 17:51
  • 2
    It's mostly the same. The US spellings are just local color/colour. – Martin James Mar 28 '15 at 17:53
  • 1
    @LightnessRacesinOrbit he said he's trying to come up with a name for a function in his codebase. So I'm pretty sure he wrote the code of the function which makes him the author, so he should do as he pleases. :) never mentioned he wrote the standard library :p – deW1 Mar 28 '15 at 17:58
  • @deW1: Yeah, I do realize that for my code I can pick whatever I want, the point is that I want the one which is consistent with the Standard Library :) – Andy Prowl Mar 28 '15 at 18:01
  • 2
    Even if this were a good question for SO, which I don't believe it is, it doesn't matter because the fact is that the names in that draft may not be changed. The result would be a mix of BrE and AmE, but there wouldn't be much of a problem with that in my opinion. Inconsistent? Definitely. Standard? Definitely. There's no standard AFAICT regarding the spellings of identifiers in the ISO C++ standard, any rationale, or even ISO as a whole. ISO only mandates that standards be submitted in well-written English and does not dictate which dialect/variant of English must be used. –  Mar 28 '15 at 19:04
  • 7
    If there were an official policy, I'd expect to find it in the [*Standard Library Guidelines*](https://isocpp.org/std/library-design-guidelines) which I cannot. In addition to the good example found by @MikeSeymour, N4140 contains a non-normative *example* (in § 7.2 [dcl.enum]) that uses the spelling “color”. – 5gon12eder Mar 28 '15 at 19:42
  • @5gon12eder in my now deleted answer, there are several examples of US spelling being used over oxford spelling: `analyze`, `behavior` and `program` and ISO Directive 2 only contains one language suggestion and it is only a suggestion. – Shafik Yaghmour Mar 28 '15 at 20:21
  • @ShafikYaghmour I regret you deleted your answer, then. – 5gon12eder Mar 28 '15 at 20:22
  • @5gon12eder: Despite Shafik Yaghmour's use of `backtick-text`, I think he just means that the *prose* of the spec uses the spellings *analyze*, *behavior*, and *program*. Your `color` example is a bit more compelling, since it's an actual code example. And your link to the *Standard Library Guidelines* is highly relevant. I think you should post an answer. – ruakh Mar 28 '15 at 20:28
  • 2
    `initializer_list`. `std::regex::optimize`. `uninitialized_copy/copy_n/fill/fill_n`. – T.C. Mar 28 '15 at 20:51
  • 4
    In 30.6.8/(3.3) from N4296, *if no value is set in the launch policy, or a value is set that is neither specified in this International Standard or by the implementation, the **behaviour** is undefined.* So even in the wording of the standard itself there seem to be some inconsistencies. – vsoftco Mar 28 '15 at 20:54
  • 3
    also `operation_canceled`. – n. m. could be an AI Mar 28 '15 at 21:02
  • @n.m. I was just about to post that O_o. Also, `has_signaling_NaN` and `signaling_NaN()`. – T.C. Mar 28 '15 at 21:03
  • 3
    @vsoftco [Not anymore](https://github.com/cplusplus/draft/commit/5dc7260ff4192beedf708dc45c9ba915daedaba1). – Casey Apr 02 '15 at 17:24

1 Answers1

9

I'd expect that, if there were an official guideline, we should be able to find it in the Standard Library Guidelines on the committee's web site. Since there are a number of items regarding naming conventions and none of them mentions American versus British English, I can only conclude that such a decision has not been made yet.

As others have commented, there is prose and at least one function name in the standard that uses the American spelling so my bet would be that it would be preferred in case of doubt. From what I can tell, this is also what most other libraries do. The Boost Library Requirements and Guidelines, by the way, don't have anything to say about this issue either.

5gon12eder
  • 24,280
  • 5
  • 45
  • 92
  • 1
    I'd also like to add that Bjarne himself has been working in mostly an American environment since the very early days of the development of C++, being the head of Bell Labs ans such for a large amount of time, so it can be inferred that the standard learns towards American English. – CinchBlue Mar 28 '15 at 21:28
  • @Cinch but Stroustrup got his PhD in Cambridge, England. – TemplateRex May 15 '15 at 17:37
  • @TemplateRex But wouldn't a working environment sort of determine which type of spelling you might use? e.g. If I were to publish in UK, I'd use UK spelling. – CinchBlue May 15 '15 at 18:37
  • @Cinch Depends on how rigorous your education was. In Europe, highschool English is usually British oriented. But I'd agree that after several decades in the US, the spelling would probably be morphed into what you are more exposed to. – TemplateRex May 15 '15 at 18:40