Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on Where to place digit separators in C23?
Post
Where to place digit separators in C23?
C23 introduces the digit separator '
which can be placed anywhere inside an integer constant for the purpose of clarity and self-documenting code. These are otherwise ignored by the compiler when determining the value of the number.
However, the language standard provides no guidance regarding how to sensibly use digit separators. These were introduced to C with proposal N2626 which in turn provides no guidance either - for example it suggests that 2'3434'5323
might be clearer to read than 234345323
, which I as a frequent user of engineering notation don't quite agree with. I believe the same feature was introduced in C++14 but with no guidance there either.
Are we to add '
at a whim or will are there any recommended practices to follow?
1 comment thread