The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

C# is NOT a portable data format specification. by etwas_egal2007-01-25 13:08:03
  Use the marshaller classes by Didactylos2007-01-25 14:10:49
    The real issue is lack of a CLR by etwas_egal2007-01-25 14:41:48
      What's broken about it? (n/t) by Didactylos2007-01-25 14:44:35
        Static array references not fixed yet by etwas_egal2007-01-25 14:53:04
          Huh? by Didactylos2007-01-25 15:05:35
            Example, massively trimmed by etwas_egal 2007-01-25 15:31:06
The cleaned up "new code" version with the nice access method.
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi, Pack=1)]
  public struct TransactionRecord {
    public int    OrderID;
    private byte  _zipCode1,
                  _zipCode2,
                  _zipCode3,
                  _zipCode4,
                  _zipCode5;
    public char[] ZipCode {
      get {
         return new char[] {
                  (char)_zipCode1,
                  (char)_zipCode2,
                  (char)_zipCode3,
                  (char)_zipCode4,
                  (char)_zipCode5
                  };
       }
    }
}
I consider it broken to have to declare each byte of what in "primitive" languages is considered a fixed length string.

In use, the code just coerces chunks of a binary buffer to/from this struct by way of unsafe pointer operations. Thus the need to explicitly define the layout, charset, and word alignment rules.

[ Reply ]
              Shouldn't you be using by Didactylos2007-01-25 15:51:38
                Some of that, yeah. That's why it's "broken". by etwas_egal2007-01-25 23:59:31
                Thanks!!! Just figured out *why* by etwas_egal2007-01-26 00:06:17

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)