@cmuratori Wanted to ask sth.In the last Witness Wednesday,you put a for loop inside a static function in a {} block.Why?
-
-
Replying to @npatsiouras
@npatsiouras It is from the days when GNU's for scoping differed from MSVC's. I believe it is no longer necessary, but I still do it.3 replies 0 retweets 0 likes -
Replying to @cmuratori
@cmuratori I see.I never understood the use of blocks.Is there any point today?Apart from short inline functions appearing once in the code.1 reply 0 retweets 0 likes -
Replying to @npatsiouras
@npatsiouras It is to scope the variables. int x = 5; { ... } ++x; is valid, whereas {int x = 5; ...} ++x; is an error.1 reply 0 retweets 0 likes -
Replying to @cmuratori
@npatsiouras So it controls the lifetime of variables for you. That is still very useful, even though the for() scoping is now standard.1 reply 0 retweets 0 likes -
Replying to @cmuratori
@cmuratori I know what it does,I just haven't found real use for it so far.And thought if it was a relic of old ways mostly.1 reply 0 retweets 0 likes
@npatsiouras A example modern use is {block_timer Timer("something"); ... } which has a constructor/destructor pair that profiles the code.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.