Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Unusal problem with variables in a global structure

Reply
Thread Tools

Unusal problem with variables in a global structure

 
 
Gokul
Guest
Posts: n/a
 
      07-28-2007
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 ?

Rgds,
Gokul

 
Reply With Quote
 
 
 
 
Doug
Guest
Posts: n/a
 
      07-28-2007
On Jul 28, 11:16 am, Gokul <gokulkumar.go...@gmail.com> 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 ?
>


Hiya,

The only thing I can think of (since you say it's been working until
now) is that maybe the structure definition has changed recently? Is
it possible it's changed and you haven't recomplied *all* the
compilation units that use the structure?

Doug

 
Reply With Quote
 
 
 
 
santosh
Guest
Posts: n/a
 
      07-28-2007
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.

 
Reply With Quote
 
Gokul
Guest
Posts: n/a
 
      07-28-2007
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SCGIServer and unusal termination Eden Kirin Python 7 11-19-2009 05:03 PM
Help with an unusal upload problem=> see text inside Tin_Ear Computer Support 0 04-28-2005 11:47 PM
Unusal Session State behavior or Server side validation? SuperSizeMe ASP .Net 3 01-14-2005 01:54 AM
Unusal problem with my ROC-7 Lago Jardin Digital Photography 0 04-20-2004 06:03 PM
unusal problem Nikhil Pandya Computer Support 1 02-22-2004 02:45 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57