• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How do I get around this?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do I get around this?


  • Subject: How do I get around this?
  • From: John Draper <email@hidden>
  • Date: Sat, 27 Nov 2004 22:56:26 -0800

I have the following definitions....

#import <strings.h>


u_char pkt[95]; u_long a_long;



  bzero(&pkt, 95);
  a_long = 23L;
  bcopy(&a_long, &pkt[UID] 4);     <---- This fails to compile...

I get: error - parse error before numeric constant?
What in tarnation does THIS mean... how can I copy the contents of a local
variable like "a_long" into a specific byte cell in the 'pkt' array of "u_char"


I have to do an insane convoluted way of dealing with odd-sized packet
fields, and when I define it as a struct, the expected struct size should be
95 bytes in length, but instead it is 100 bytes in length. WTF?


Ok,  so time for plan B...  I'm just going to use a character array of
8 bit bytes,  and MOVE the variables into the proper offset....  I know
it's a serious kludge,  but I got no other choice,

Of course I did the

#pragma option align=packed

Ran some tests, and (sigh), I just cannot start on an odd-byte boundary for
a field.... is there any other way?


Also tried:

#pragma pack(1)

But (sigh) that don't work either....   is there ANY hope?

John

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: How do I get around this?
      • From: Kevin Ballard <email@hidden>
  • Prev by Date: Re: [ANN] Value Converter
  • Next by Date: Re: How do I get around this?
  • Previous by thread: Re: Seeking comments: an Objective-C reference card for Java programmers
  • Next by thread: Re: How do I get around this?
  • Index(es):
    • Date
    • Thread