C++ parsing question

John Levon moz@compsoc.man.ac.uk
Tue Nov 7 08:18:00 GMT 2000


Is it possible to do what is implied by this code :

if ((const char*  p = func()) && *p) { 
	// deal with p
}

i.e. declare and initialise a pointer p and then check the contents all
within the conditional

I don't have a C++ standard to check what the problem is here...

g++ 2.95.2

thanks
john

-- 
"Alan Turing thought about criteria to settle the question of whether
 machines can think, a question of which we now know that it is about
 as relevant as the question of whether submarines can swim."
	- Dijkstra



More information about the Gcc-help mailing list