lundi 7 octobre 2019

type aliasing and similar types

On cpp reference it is said that two pointers are the same if ignoring the top level cv qualifiers they point to the same type. In the examples then there is this example

int (* const *)(int *) and int (* volatile *)(int *) are similar; 

I was wondering how are those supposed to be similar? AFAIK those represent a pointer to a pointer to a function, to simiplify they could be rewritten as

 using XYZ = int(*)(int *);
 const XYZ *;     // A
 volatile XYZ *;  // B

Aren't A and B pointers to different types in that case?

Aucun commentaire:

Enregistrer un commentaire