CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Mar 2006
    Posts
    9

    Struct member manipulation

    I work on a system that communicates with other systems via messages. Those messages are defined in a spec and every word must be exactly as defined. To accomplish this Ada allows me to define the fields of my record to specific words in memory. Will C++ allow me to accomplish this same task and if so could someone post an example

    Code:
    word = 4;
    
    type Msg_Type1 is record
       x: Some_Type;
       y: Another_Type;
       z: Another_Type;
    end record;
    
    // ada allows me to rep out my record using the 'for use' clause
    for Msg_Type1 use record
       x at 0*word range 0..31;
       y at 1*word range 0..15;
       z at 1*word range 16..31;
    end record;
    Last edited by tsnofvdr; December 5th, 2012 at 02:13 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured