Overcoming the "Most Vexing Parse" Problem
Oct 15, 2009, 21:33 (1 Talkback[s])
WEBINAR:
On-Demand
How to Help Your Business Become an AI Early Adopter
"The C++ literature uses the phrase "most vexing parse" to
denote one of the dark syntactic alleys of C++. It's vexing because
programmers usually don't even know it exists; they assume that
their code creates an object initialized with a temporary, whereas
the compiler interprets that same code as no less than a function
declaration. This 10-Minute Solution explains where and why that
parse problem happens, and presents two simple techniques to avert
it.
"You define an object whose initializer is a temporary, but the
compiler unexpectedly interprets the code as a function
declaration.
"Rewrite your code so that it avoids the most vexing parse
problem."
Complete
Story
Related Stories:
- Teaching Kids Programming with Free Programming Languages(Oct 02, 2009)
- C++, the GPU, and Thrust: Sorting Numbers on the GPU(Sep 26, 2009)
- C++ : Understanding pointers(Sep 17, 2009)
- C++0x Forward Enum Declarations Cut Down Compilation Time and Dependencies(Aug 13, 2009)
- C++0x not before 2010 and without 'concepts'(Jul 26, 2009)
- Click2try Adds Linux C/C++ Developer Workstation(Jul 08, 2009)
- C/C++ reference counting with atomic variables and gcc(May 28, 2009)
- Learning C/C++ Step-By-Step(Jan 09, 2009)