C++ Parser and gcc internal defines

Esben Mose Hansen kde at mosehansen.dk
Sat May 29 09:18:09 BST 2010


On Saturday 29 May 2010 01:55:35 Gunther Piez wrote:
> These are special macros which depend on the current state of the 
> preprocessor. It makes no sense to predefine them. IMHO it would be
> sufficient  to expand them always to an empty but defined macro.

Not quite. That would make code like

std::cout << __LINE__ << " had a problem today";

fail to parse. It would actually be worse than today, since the syntax error 
flagged would be meaningless, while today everyone can grasp that kdevelop 
simply does not know about __LINE__. It needs to expand to something of the 
correct type at least. From memory, that would be:

__FUNC__	string literal
__LINE__	int literal
__FILE__	string literal
__FUNCTION__	string literal
__PRETTY_FUNCTION__	string literal
__func__	const char* const

Expanding to the correct value is, on the other hand, probably overkill.

-- 
Kind regards, Esben




More information about the KDevelop mailing list