Reputation: 364
I'm working with very large integer literal defines eg:
#define X 999999999999
To improve readability I tried changing this to:
#define X 999/**/999/**/999/**/999
But the compiler was like "nah bru.."
Is there any way to make these more readable?
Just to clarify, this question is asking only about the appearance of the values in the source code. I'm not asking how to format these values in a printf or anything.
Upvotes: 3
Views: 274
Reputation: 81926
You could do this:
#include <boost/preprocessor.hpp>
BOOST_PP_SEQ_CAT((345)(678)(901))
Which would show up in source code as:
345678901
Upvotes: 1
Reputation: 241701
You can do this in a define (but not outside of a define):
#define X 999##111##333##444
I'm not sure that I'd recommend it, but it's legal. (##
is the preprocessor token concatenation operator.)
You explicitly didn't ask about output formatting, so you're probably not interested in input formatting either, but both of them can be made locale-aware, which includes allowing locale-specific grouping characters.
Upvotes: 4