On Mon, Mar 14, 2011 at 12:18:16PM +0200, Janne Blomqvist wrote:
> On Sat, Mar 12, 2011 at 17:21, FX <fxcoud...@gmail.com> wrote:
> A static variable which is modified introduces a race condition.

That is true.

> Secondly, you reset the count to 0 at the start of every loop which
> makes the static thing superfluous?

This is wrong, in C, C++
static int count = 0;
means that the static variable is initialized to 0 in its static storage,
not that count = 0; is executed anywhere where the static block local
variable enters its scope.  The "= 0" part is redundant for static vars
BTW, static vars are initialized to 0 when they don't have an explicit
initializer.

If M$ mktemp when already 26 files exist with the same prefix at least
properly fails, then it would be better to just retry with a changed prefix
if it fails.

        Jakub

Reply via email to