Re: Help with POSIX
Re: Help with POSIX
- Subject: Re: Help with POSIX
- From: Charles Steinman <email@hidden>
- Date: Fri, 18 May 2007 08:09:30 -0700 (PDT)
POSIX uses the _t suffix to indicate type names. The pelco_t type and pelco variable have no relationship from a language standpoint. They're related semantically (the pelco_t values stand for indices in the array), but one is a typedef'd enum and the other is an unsigned char array variable. No trickery going on here.
Cheers,
Chuck
Vince Ackerman <email@hidden> wrote: Maybe this isn't the right forum for this question. I looked at the
other Apple Mailing lists and they don't seem to apply. If I missed
something forgive me in advance, but I'm a Newbie trying to
understand some C Code that I'm trying to port to a Cocoa app I'm
writing.
Could someone explain the "_t" characters following this typedef:
typedef enum {p_sync,p_addr,p_cmd1,p_cmd2,p_data1,p_data2,p_cksum}
pelco_t;
Later in the code the author declares a variable:
unsigned char pelco[7];
This is confusing to me. Does the compiler drop the "_t" and know
that this applies to the char array defined as "pelco" ? I see no
other reference defining this array other than code loading up the
bytes:
- (void)turnOff
{
memset(pelco,0,sizeof(pelco));
pelco[p_sync] = 0xff;
pelco[p_addr] = addr;
pelco[p_cmd1] = 0x08;
pelcoChecksum();
pelcoWrite(pelco,sizeof(pelco));
}
In trying to understand this I see references to POSIX reserving the
use of the "_t" format but not how to use it.
I'm sure this is a totally dumb question, but would appreciate any
sort of enlightenment.
Vince
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
---------------------------------
Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden