What is a vacuous type?

This is a discussion on What is a vacuous type? within the C Programming forums, part of the General Programming Boards category; ok, I'm a noob. I'm not ashamed to say it. So I'm programming along and then I hit shift+F10. I ...

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    2

    What is a vacuous type?

    ok, I'm a noob. I'm not ashamed to say it.

    So I'm programming along and then I hit shift+F10. I sit back and watch the compiler output; I take it as my PC saying, "Oooh yeah, right there. Wow, you're such a natural...how many compilers have you been with?"

    Then all of a sudden, bam:
    Error 43 Vacuous type for variable 'ovation'
    make: Error code 2

    What is a vacuous type? Why is the code below considered a vacuous type? From the little bit of information I found, this seems to be saying: "The variable type is has not yet been defined, and therefore has no set structure or size. This is not allowed; UBYTE me."

    here's where the type is declared in my_type.h:
    Code:
    typedef unsigned char 	UBYTE;     /* unsigned 8 bit byte */
    and here's how it's referenced:
    Code:
    typedef  struct {
    /* Array of hex values that will be sent to a USB device */
        const UBYTE ovation [] = 
    	{ 
    		0x55, 0x53, 0x42, 0x43,  /* Bytes 0..3   */
    		0xB0, 0x4C, 0x36, 0x87,  /* Bytes 4..7   */
    		0x24, 0x00, 0x00, 0x00,  /* Bytes 8..11  */
    		0x80, 0x00, 0x06, 0x12,  /* Bytes 12..15 */
    		0x00, 0x00, 0x00, 0x24,  /* Bytes 16..19 */
    		0x00, 0x00, 0x00, 0x00,  /* Bytes 20..23 */
    		0x00, 0x00, 0x00, 0x00,  /* Bytes 24..27 */
    		0x00, 0x00, 0x00, 0x00,  /* Bytes 28..31 */ 
    	}; 
    } EJECT_CMD;
    compiler: Diab D-CC ver 4.3b
    OS: winXPsp2
    Last edited by ladebak; 10-12-2008 at 12:39 AM. Reason: there was a typo in the posted code. Thx SMurf

  2. #2
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,266
    ZK_UBYTE != UBYTE perhaps?

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    2

    good catch!

    Quote Originally Posted by SMurf View Post
    ZK_UBYTE != UBYTE perhaps?
    I didn't see it, but the ZK_ was just a typo in my post. the code I'm using actually does list just UBYTE in my_type.h, not ZK_UBYTE.

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    I'm hoping you did include your "my_byte.h" file.

    And are you allowed to assign data in the middle of a structure definition? I'm pretty sure the answer is "No". It looks like you should have something like
    Code:
    typedef struct {
        const UBYTE ovation[32];
    } Command;
    Command EJECT_CMD = { 
    		0x55, 0x53, 0x42, 0x43,  /* Bytes 0..3   */
    		0xB0, 0x4C, 0x36, 0x87,  /* Bytes 4..7   */
    		0x24, 0x00, 0x00, 0x00,  /* Bytes 8..11  */
    		0x80, 0x00, 0x06, 0x12,  /* Bytes 12..15 */
    		0x00, 0x00, 0x00, 0x24,  /* Bytes 16..19 */
    		0x00, 0x00, 0x00, 0x00,  /* Bytes 20..23 */
    		0x00, 0x00, 0x00, 0x00,  /* Bytes 24..27 */
    		0x00, 0x00, 0x00, 0x00,  /* Bytes 28..31 */ 
    	};

  5. #5
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,832
    What is a vacuous type?

    I think it's when you declare a variable with the blonde data type.

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Apparently (as found by google) Vacuous means "hollow". As to what the compiler is actually complaining about, I'm not quite sure.

    You probably need to ask Diab (or whoever represents them) for the actual answer to what this means.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    gcc's error messages may be more "customary" to all of us:
    Code:
    temp.c:6: warning: no semicolon at end of struct or union
    temp.c:6: error: syntax error before ‘=’ token
    temp.c:17: warning: type defaults to ‘int’ in declaration of ‘EJECT_CMD’
    temp.c:17: warning: data definition has no type or storage class
    Again, it would appear the error is the illegal initialization inside of a struct definition.

    Edit: And I've never quite seen "hollow" as a def. of vacuous -- it means empty or lacking content (a statement is called "vacuous" or "vacuously true" if it has no content, like "A man is a man.").

  8. #8
    Registered User
    Join Date
    Sep 2004
    Posts
    123
    I added it to a noddy program as such:

    Code:
        +5  typedef  struct {
        +6  /* Array of hex values that will be sent to a USB device */
        +7      const UBYTE ovation [] =
        +8          {
        +9                  0x55, 0x53, 0x42, 0x43,  /* Bytes 0..3   */
       +10                  0xB0, 0x4C, 0x36, 0x87,  /* Bytes 4..7   */
       +11                  0x24, 0x00, 0x00, 0x00,  /* Bytes 8..11  */
       +12                  0x80, 0x00, 0x06, 0x12,  /* Bytes 12..15 */
       +13                  0x00, 0x00, 0x00, 0x24,  /* Bytes 16..19 */
       +14                  0x00, 0x00, 0x00, 0x00,  /* Bytes 20..23 */
       +15                  0x00, 0x00, 0x00, 0x00,  /* Bytes 24..27 */
       +16                  0x00, 0x00, 0x00, 0x00,  /* Bytes 28..31 */
       +17          };
       +18  } EJECT_CMD;
    and received the following compiler errors:

    "tester2.c", line 7.17: 1506-277 (S) Syntax error: possible missing ';' or ','?
    "tester2.c", line 17.9: 1506-278 (S) The structure definition must specify a member list.

    A Web search on "vacuous type for variable" turned up 8 results, one of which was this:
    http://gimpel-online.com/MsgRef.html

    Doesn't seem to be the same set-up, but the error number 43 is the same - quite a long page, so do a control-F search on the word 'vacuous'.

  9. #9
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    <- link

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 0
    Last Post: 03-20-2008, 08:59 AM
  2. Replies: 28
    Last Post: 07-17-2006, 12:35 AM
  3. Compiler "Warnings"
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 04-24-2005, 02:09 PM
  4. Errors
    By Rhidian in forum C Programming
    Replies: 10
    Last Post: 04-04-2005, 01:22 PM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 07:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21