On Mon, Jan 12, 2009 at 09:27:42PM +0100, Pavel Sanda wrote:
> Pavel Sanda wrote:
> > hi,
> > 
> > i have the following codes:
> > 
> > #1:
> > case LFUN_VC_COMMAND: {
> >     string path = cmd.getArg(1);
> >     support::PathChanger p(FileName(path));
> > 
> > 
> > #2:
> > case LFUN_VC_COMMAND: {
> >     string path = cmd.getArg(1);
> >     support::PathChanger p(FileName(cmd.getArg(1));
> > 
> > 
> > in the first case path is not changed, in the second case the path is 
> > changed.
> > when i put lyxerr<<"blabla" into the constructor of pathchanger the message
> > is showed only in the second case.
> > 
> > i hope i'm too much tired and missing something obvious because the compiler
> > shouldn't "optimalize" this code (p is not used anywhere else in the block).
> 
> this way it works too:
> 
> case LFUN_VC_COMMAND: {
>       string path = cmd.getArg(1);
>       FileName pp(path);
>       support::PathChanger p(pp);

It's nasty when optimizers 'improve' ;-}

Could you try to add a 'volatile' in front of the 'support::PathChanger p(pp)'
and see whether it makes a difference?

[I think it should not, but then, the optimizer seems overly eager here]

Andre'

Reply via email to