C++26: The Oxford variadic comma

C++26 brings us a small but meaningful cleanup to the language: deprecating ellipsis parameters without a preceding comma. This change, proposed in P3176R1, aims to improve C compatibility, reduce confusion, and pave the way for future language features. The proposal’s name is a playful reference to the Oxford comma - that final comma before “and” in a list. Just as the Oxford comma clarifies lists in English, this proposal mandates a comma before the ellipsis in function parameters. The problem First, let’s clarify terminology. This proposal is about ellipsis parameters - the C-style variadic parameters you might know from printf. These are different from template parameter packs, even though both use the ... syntax. Currently, C++ allows two ways to declare an ellipsis parameter: 1 2 void foo(int, ...); // with comma (C-compatible) void foo(int...); // without comma (C++-only) The second form without the comma originates from early (pre-standard) C++ function prototypes, but has remained part of standardized C++ ever since. Interestingly, C has never allowed the comma to be omitted. The C standard, unchanged since C89, requires: 1 2 // In C, only this form is valid: int printf(char*, ...); C++ later added support for the comma-separated form for C compatibility, but kept the old syntax for backwards compatibility. This creates an awkward situation where (int, ...) is compatible with both languages, but (int...) only works in C++. Why is this confusing? The real confusion comes from template parameter packs, introduced in C++11. Consider this example: 1 2 template<class Ts> void f(Ts...); // well-formed: a parameter of type Ts followed by an ellipsis parameter Many users associate (T...) with a parameter pack, not with an ellipsis parameter. Instead, it’s a single parameter of type Ts followed by an ellipsis parameter! To actually declare a parameter pack, you need: 1 2 template<class... Ts> void f(Ts... args); // args is a parameter pack The situation gets even more confusing with abbreviated function templates: 1 2 3 4 5 // abbreviated variadic function template void g(auto... args); // abbreviated non-variadic function template with ellipsis parameter void g(auto args...); These two look similar but have completely different meanings. The latter should be deprecated. The curious case of six dots Perhaps the most bizarre syntax enabled by the current rules is this: 1 void h(auto......); // equivalent to (auto..., ...) Yes, that’s six consecutive dots - if I counted it right. This declares a function template parameter pack followed by an ellipsis parameter. While technically possible to use (if the pack belongs to a surrounding class template), the syntax strongly suggests all dots apply to auto, which is misleading. What’s being deprecated? C++26 will deprecate ellipsis parameters without a preceding comma. Specifically: 1 2 3 4 5 6 7 8 9 // Deprecated in C++26: void f(int...); void g(auto args...); template<class T> void h(T...); // T is not a parameter pack // Preferred (and C-compatible): void f(int, ...); void g(auto args, ...); template<class T> void h(T, ...); The standalone ellipsis parameter remains valid: 1 void f(...); // still valid, C-compatible, unambiguous Impact This is a pure deprecation - removal had been already refused before. No existing code becomes ill-formed. Any deprecated uses can be mechanically transformed by adding a comma before the ellipsis. This transformation is simple enough to be automated by tooling. The proposal doesn’t estimate how much code will be affected, though the author found several dozen occurrences of the T...... pattern in a GitHub code search. The real number of affected declarations is likely non-trivial, finding them requires semantic analysis since (T...) could be either an ellipsis parameter or a parameter pack depending on context. This deprecation clears the path for future language features. The syntax (int...) has already blocked proposals like P1219R2 “Homogeneous variadic function parameters”, which would have given this syntax a new meaning. By deprecating the comma-less form, the committee preserves design space for future evolution while improving consistency with C and reducing a common source of confusion. Conclusion The Oxford variadic comma is a small change with multiple benefits: better C compatibility, reduced confusion with parameter packs, and preserved design space for future features. While the title is playful, the motivation is serious - cleaning up a historical artifact that serves little purpose in modern C++. If you’re using ellipsis parameters, start adding that comma before the .... Your code will be more C-compatible, less confusing, and ready for whatever comes next. Connect deeper If you liked this article, please hit on the like button, subscribe to my newsletter and let’s connect on Twitter!

Sandor Dargo’s Blog

Has the article writer ever considered using anything besides a comma (,)?

#comma #punctuation

Thousands of medieval manuscripts finally transcribed

Transcribing thousands of medieval manuscripts by hand would be a monumental undertaking. Fortunately, researchers in computational humanities at the Inria Paris Centre have been able to automate the task through the use of #generativeAI. Their creation is #CoMMA, a giant, one-of-a-kind corpus that will now be available to specialists in the humanities, revolutionising the exploration of writing from the Middle Ages. https://www.inria.fr/en/comma-medieval-manuscripts-transcribed

CoMMA: thousands of medieval manuscripts finally transcribed | Inria

Transcribing thousands of medieval manuscripts by hand would be a monumental undertaking. Fortunately, researchers in computational humanities at the Inria Paris Centre have been able to automate the task through the use of generative AI. Their creation is CoMMA, a giant, one-of-a-kind corpus that will now be available to specialists in the humanities, revolutionising the exploration of writing from the Middle Ages.

Styles guide: is Harry’s album Kiss All the Time. Disco, Occasionally. grammatically correct?

The follow-up to 2022’s Harry’s House boasts an esoteric title – but experts say ambiguity might be the goal

The Guardian

@gutenberg_org

⬆️ 👀 ❗

"in 1905, #Moscow printers demanded to be paid for setting not only letters but also #punctuation marks, which required the same action and the same amount of time as the alphabet. What is known as the #CommaStrike spread popular #boycott throughout the country, leading to the #czar ceding #Russia its first constitution. A #comma can, more or less, get the blood boiling."

Citing https://www.jstor.org/stable/43204460?seq=3

THE STRIKE AND THE REVOLUTION: A Comparative Study of the Russian Revolutions of 1905 and 1917 and 1953 and 1956 Revolts in Eastern Germany, Russia, Poland and Hungary on JSTOR

Feliks Gross, THE STRIKE AND THE REVOLUTION: A Comparative Study of the Russian Revolutions of 1905 and 1917 and 1953 and 1956 Revolts in Eastern Germany, Russia, Poland and Hungary, Il Politico, Vol. 22, No. 2 (SETTEMBRE 1957), pp. 510-518

Never imagined myself enjoying doing Deaf theatre. Soldout shows, and tonight is the last night. It has truly been an honor to do this again with a collective of talented people and to watch something grow with our local Deaf community. 💚🖤💚

#DerekLong #trash #ASL #DeafTheatre #deafarts #AndrewMorrill #JamesCaverly #KeeLee #CoMMA

In absentia of the last two months; been busy with work, family and collaborating once again with in another theaterical production.

"Trash", an original Deaf play written by Deaf playwrights James Caverly and Andrew Morril

Produced by Derek Long LLC

Directed by Kee Lee

All proceeds go to benefiting Alder Springs Deaf and Blind Community

www.dereklong.net

https://youtu.be/YUq-m287mcw?si=mH3w_ZizUqnuxNYv

#Deaf #ASL #Deafculture #deafarts #dereklongllc #KeeLee #AndrewMorrill
#JamesCaverly #DeafTheatre #CoMMA

TRASH Trailer

YouTube
Got to love #Grammarly going: hey dude you're missing a #comma after #Hell

So we are lecturing people about if and how to use hashtags now too?

#Get #A #Fucking #Life #Comma #Seriously #ExclamationMark

Can't we just agree on not being an asshole?
In my book that already includes using ALT text and especially not lecturing people.

But what do I know...

New work in the studio.
‘What will be, will be’, 2025, acrylic on glass bowls, Ø 20.5 x 10 cm.
#flowers #nature #bowls #drop #comma #contemporaryart #galerieramakers #drawing #painting