On Jul 28, 3:43 pm, santosh <santosh....@gmail.com> wrote:
> Gokul wrote:
> > We are facing an unusual problem with variables in a global structure.
> > These variables are assigned values like mad all over the application.
> > Agreed, it is a bad design. The application has been running Ok so
> > far. The problem is, these variables are not assigned properly
> > anymore.
>
> > typedef struct order {
> > int order_id;
> > int order_seq;
> > .
> > .
> > .
> > } ORDER_REC;
>
> > After assigning values, the values are shifted to the variables
> > declared above them. The value of order_seq is seen in order_id and
> > order_seq remains zero. This is the case with all the other variables.
> > Move a level up !. Is this a known issue with assigning variables in a
> > global structure ?
>
> No, there are no such issues with C itself, it's most likely a flaw in your
> application somewhere.
>
> How exactly is the structure written to? Are all members of the structure of
> the same type? Is your application a multi-threaded one?
>
> We really can't say more without some more details and/or code.- Hide quoted text -
>
> - Show quoted text -
Doug, I have checked that. No problem there.
To try some options, I declared a structure with local scope, did all
processing and just before returning from the function I copied the
local structure data to the global one. It worked fine. But I am
unable to understand why this happens.
|