From: Trups on
Hi All,

I am facing a strange problem..
I am calling a function func2 from func1. Before calling func2 all
the local variables in func1 looks fine and has their respective
values. When function returns back from func2 to func1 all the local
variables in func1 has values 0xfdfdfd.
Can somebody please explain me what is happening and what is the
solution for this?
Thanks
Trupti

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Mathias Gaunard on
On 17 juin, 00:59, Trups <Samant.Tru...(a)gmail.com> wrote:
> When function returns back from func2 to func1 all the local
> variables in func1 has values 0xfdfdfd.
> Can somebody please explain me what is happening and what is the
> solution for this?

It looks like your stack has been corrupted, which would have been the
result of some undefined behaviour you invoked earlier.
The solution is to therefore not invoke UB.

You may want to use the 'valgrind' debugging tool to see where you
mess up your memory.


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Thomas Richter on
Trups schrieb:
> Hi All,
>
> I am facing a strange problem..
> I am calling a function func2 from func1. Before calling func2 all
> the local variables in func1 looks fine and has their respective
> values. When function returns back from func2 to func1 all the local
> variables in func1 has values 0xfdfdfd.
> Can somebody please explain me what is happening and what is the
> solution for this?

No, not without looking at your code. My best guess is that you somehow overwrite
the stack in func2 (i.e. you run into UB in func2 for some reason), but without
any code that's hard to tell.

So long,
Thomas

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: macabre13 on
On 17 Cze, 00:59, Trups <Samant.Tru...(a)gmail.com> wrote:
> Hi All,
>
> I am facing a strange problem..
> I am calling a function func2 from func1. Before calling func2 all
> the local variables in func1 looks fine and has their respective
> values. When function returns back from func2 to func1 all the local
> variables in func1 has values 0xfdfdfd.
> Can somebody please explain me what is happening and what is the
> solution for this?
> Thanks
> Trupti

{ The clc++m banner is removed; please, don't quote it! -mod }

Show the code please

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Francis Glassborow on
Trups wrote:
> Hi All,
>
> I am facing a strange problem..
> I am calling a function func2 from func1. Before calling func2 all
> the local variables in func1 looks fine and has their respective
> values. When function returns back from func2 to func1 all the local
> variables in func1 has values 0xfdfdfd.
> Can somebody please explain me what is happening and what is the
> solution for this?
> Thanks
> Trupti
>

looks as if func2 is corrupting the stack. Without seeing them it is
impossible to say more.

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]