Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Clarification for Rule 5-2-4
#1
1. Does the phrase "functional notation cast" in the rule correspond to what the C++ standard calls an "Explicit type conversion (functional notation)", or is there a distinction?

2. Does the phrase "explicit constructor call" in the rule mean "explicit-constructor call" (a call to a constructor declared with the 'explicit' specifier) or "explicit constructor-call" (an explicit call to a constructor, as opposed to an implicit conversion that uses a user-defined converting constructor)?

3. The rationale refers to dangers associated with casts that "do not invoke a converting constructor", however a "converting constructor" is a constructor that was *not* declared with the 'explicit' specifier. Was this intended to refer to casts that *do* invoke a converting constructor [as opposed to an explicit constructor]?

4. In the first compliant example with the expression 'A(10)' the declared constructor 'A(int32_t)' is declared with the explicit specifier. Would the 'A(10)' example be non-compliant if this constructor declaration lacked the 'explicit' specifier?

5. In later versions of the C++ standard, "Explicit type conversion (functional notation)" includes a type name followed by a braced list, e.g. 'X{5}', which may be used for aggregate initialization for 'struct X { int32_t a; };'. Is it within the original spirit of the rule to include this sytnax?
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)