I don't think so.  What he meant is:

typedef struct
{
   static UInt32 test;
} Test;

NOT

typedef struct
{
  UInt32 test;
} Test;

A struct is nothing more than a public class.   It doesn't make a difference
whether you're writing in C++ or C.


Herry



----- Original Message -----
From: "Steve Achelis" <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Wednesday, January 31, 2001 1:27 PM
Subject: Re: static ints


> The reply by "herry" assumes you are writing in C++.  I'm assuming you're
> writing in C.  Anyway, it worked for me (i.e., test->test was 10, not
zero).
>
> FWIW, the use of "test" for both the typedef, the structure, and the
> variable make the example harder to follow (and more prone to programmer
> error).
>
> Also, your message is about a static int, but there is nothing static
here.
> The Test object is created and destoryed in foo().
>
> Steve
>
>
> "Nicolas Raitman" <[EMAIL PROTECTED]> wrote in message
> news:37683@palm-dev-forum...
> >
> > Hi to all... is there any reason for which I cannot declare this:
> >
> > typedef struct
> > {
> >     UInt32 test;
> > } Test;
> >
> > the problem here is in declarating the static UInt32. I do not know why
> but
> > when I do this:
> >
> > void foo (void)
> > {
> >     Test test;
> >     foo2(&test);
> >     /* here test.test will be equal to 0, why? at least in my code, what
> am
> > I doing wrong? can I declare an integer static ???? */
> > }
> >
> > void foo2 (Test * test)
> > {
> >     test->test = 10;
> > }
> >



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to