vendredi 16 juillet 2021

Is (int*) &var same as reinterpret_cast? [duplicate]

I've seen a question What does (int*) &var mean? with such code

  char i;
  int* p = (int*) &i;

When I was trying to understand from here this part

#define     vertexmark(vx)   ((int *) (vx))[m->vertexmarkindex] 
#define     setvertexmark(vx, value)   ((int *) (vx))[m->vertexmarkindex] = value

It seems quite similar but the second piece of code is still confusing for me. Can somebody please explain what is goin on?

Also I'm curious with modern C++11 this type of C-style cast should be replaced with reinterpret_cast?

Aucun commentaire:

Enregistrer un commentaire