Most vexing parse
Syntactic ambiguity in C++
The most vexing parse is a counterintuitive ambiguity resolution in C++. In certain situations, the C++ grammar cannot distinguish between initializing an object parameter, declaring an object or declaring a function while specifying the function's return type.
Nº Q6916825 ★
Common · History
Most vexing parse
Syntactic ambiguity in C++
The most vexing parse is a counterintuitive ambiguity resolution in C++. In certain situations, the C++ grammar cannot distinguish between initializing an object parameter, declaring an object or declaring a function while specifying the function's return type.
Last price
—
Floor price
—
7-day median
—
30-day sales
0
30-day range
—
In circulation
0
Price history
median
low – high
sales
No sales in this period
Show table
| Date | median | Low | High | sales |
|---|
Sales history
- Last sale
- —
- 30-day average
- —
- 30-day low
- —
- 30-day high
- —
- Sales 7d
- 0
- Sales 30d
- 0
No sales yet.
Anonymous sales: no buyer or seller shown. Figures count player-to-player sales only.
From Wikipedia
The most vexing parse is a counterintuitive ambiguity resolution in C++. In certain situations, the C++ grammar cannot distinguish between initializing an object parameter, declaring an object or declaring a function while specifying the function's return type. In these situations, the compiler is required to interpret the statement as the latter, even though this is rarely the programmer's intention. The problem originates from backward compatibility constraints imposed by the need for C++ to be a superset of C. C has no concept of object creation, and thus will always parse the code as a function declaration. C++ introduced syntax for object creation that inadvertently coincides with function type declaration in some cases. The term was first used by Scott Meyers in his 2001 book Effective STL. It was a common problem for C++ versions prior to C++11, which introduced an alternative syntax called uniform initialization that uses braces {} instead of parentheses (), avoiding the syntactic ambiguity.
Text: Wikipédia, CC BY-SA 4.0. ·
Related cards
LL parser
Left-to-right, leftmost derivation top-down parser for a subset of context-free languages
Nº Q932615 ★★
Pragma once
Directive in C and C++ provided as a language extension
Nº Q307472 ★★
C syntax
Set of rules governing writing of software in the language
Nº Q590541 ★
Clang
Compiler front-end
Nº Q864915 ★★
Parsing
Process of analyzing a string of symbols, either in natural language, computer languages or data structures, conforming to the rules of a formal grammar
Nº Q194152 ★★
Objective-C
General-purpose, high-level, object-oriented programming language
Nº Q188531 ★★★