jeudi 4 juin 2020

Initialize C-style array with non-constant variables or function's return value

Is this valid, portable and fashionable code in C++ 11?

uintptr_t sysIDs[] =
{
  obj1->GetSysObj(),
  obj2->GetSysObj(),
  obj3->GetSysObj()
};

I mean it compiles in my compiler and from what I googled, it is okay. Just want to be sure. Because I didn't find this exact example.

Also, did it work in C++ 98 and does it work in C?

Aucun commentaire:

Enregistrer un commentaire