CV qualifier and substitutions

Alain Miniussi alainm at cup.hp.com
Sat Apr 8 00:42:14 UTC 2000


CV-qualifiers appears in two productions of the mangling grammar:
<type> ::= <CV-qualifier> <type> (actually, the <type> is missing 
                                  in the html document)
<qualified-name> = <CV-qualifier> <qualified-name>

It raise a question wrt substitution, consider the declaration:
     int* volatile const restrict p 
Those mangled type is:
     rVKPi

If i am correct, at the end of this mangled sample, we have:

<type> S3_
  <cv>
    "restrict"
  <type> s2_
     <cv>
        "volatile"
     <type> S1_
        <cv>
          "const"
        <type> S0_
           "pointer to"
           <type> S_
             <builtin>
                 "int"

IOW, the CV qualification is decomposed and "int*" "int* const" 
"int* const volatile" "int* const volatile restrict" are all
possible sources for future substitution.

Now, my question is: since a possible (widely used ?) implementation
for cv qualified name is to associate a cv-mask with a type (ie, we
don't systematicaly have a representation for each possible source
of substitution), maybe it would be better to only allow (just to 
give the idea):

<type> ::= <CV-qualifier>* <type>

<type> S1_
  <cv>
    "restrict"
  <cv>
    "volatile"
  <cv>
    "const"
  <type> s0_
     "pointer to"
      <type> S_
        <builtin>
          "int"

Any opinion ?

Alain




More information about the cxx-abi-dev mailing list