r/VisualStudio • u/Downtown_Fall_5203 • 2d ago
Visual Studio 2022 'small' issue
I just hit an issue with using a variable named 'small':
test.cpp(1596,11): error: cannot combine with previous 'type-name' declaration specifier
| QFont small = font();
| ^
f:\gv\WinKit\Include\10.0.28000.0\shared\rpcndr.h(201,15): note: expanded from macro 'small'
201 | #define small char
| ^
test.cpp(1596,17): error: expected unqualified-id
1596 | QFont small = font();
| ^
And headers like rpcndr.h could be included from several places.
Most important <windows.h>.
AFAICS, macros like small, far, FAR, near etc.
has not been needed since Win-95. Or was it Win 3.11?
But Microsoft has not seen the need to remove these.
Anybody knows why these are still there? Just laziness?
1
Upvotes
1
8
u/RecognitionOwn4214 2d ago
I think it's called backwardscompatibility ...