Menu

typedef Question

2002-12-14
2012-09-26
  • Nobody/Anonymous

    I was wondering weather or not you could define a bitfield for a bit or a byte then rename int as a byte. Like this
    union {
    int bit : 1;
    int byte : 8;
    };

    typedef int bit;
    typedef itn byte;

    I tried it out like that but it didn't work.  Is there a way to do this?

     
    • Nobody/Anonymous

      Union members have separate name space, so your typedef's only declare new typedef name bit with type int and byte with type itn what are not bitfields and not union members.

      tkorrovi

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.