1
bool function()
{

static const vector<unsigned char>header = {0x00 , 0x01 , 0x02};

//use header

}

Threads could be active before initialization in a constructor in the class using my function

Cœur
  • 37,241
  • 25
  • 195
  • 267
ashok v
  • 408
  • 3
  • 11
  • 1
    This is [thread safe](http://stackoverflow.com/q/27286444/1708801) while C++03 this was not. – Shafik Yaghmour Dec 09 '14 at 18:51
  • @ShafikYaghmour: feel free to close it as dup. I would do it if I had close votes left. – László Papp Dec 09 '14 at 18:52
  • @lpapp I answered the question I linked so I won't dup hammer close it see [this meta thread](http://meta.stackoverflow.com/q/277126/1708801) .. not clear to me if it is an exact dup although clearly related. – Shafik Yaghmour Dec 09 '14 at 18:53
  • @lpapp: what's your relation to the OP? – Cheers and hth. - Alf Dec 09 '14 at 18:54
  • @ShafikYaghmour: have no clue why it would be abuse. Although it is possible that the other question is dup, too. – László Papp Dec 09 '14 at 18:55
  • @Cheersandhth.-Alf: I am the OP's 6th sense. – László Papp Dec 09 '14 at 18:56
  • @lpapp well I think George's point is that since it is a unilateral action you need to be extra sensitive to how others may perceive a conflict of interest. I am never quite sure what should be considered dups so unless it is blindingly obvious I usually tend not to close as a duplicate. – Shafik Yaghmour Dec 09 '14 at 19:02
  • @ShafikYaghmour: I think it is blindingly obvious, but we can always reopen it if you make a mistake. We do not hold grudges, at least I do not. ;-) Thank you for your link. – László Papp Dec 09 '14 at 19:03

1 Answers1

4

It's already tread safe.

Now isn't that nice.

Cheers and hth. - Alf
  • 142,714
  • 15
  • 209
  • 331