Results 1 to 2 of 2

Thread: Enumerated VARs

  1. #1

    Thread Starter
    Frenzied Member Technocrat's Avatar
    Join Date
    Jan 2000
    Location
    I live in the 1s and 0s of everyones data streams
    Posts
    1,024

    Enumerated VARs

    Someone asked me about what these were, and for the life of me I can't come up with a good, easy to understand explanation. Someone care to help me out on this one?
    MSVS 6, .NET & .NET 2003 Pro
    I HATE MSDN with .NET & .NET 2003!!!

    Check out my sites:
    http://www.filthyhands.com
    http://www.techno-coding.com


  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Do you mean enums?

    An enum is a collection of integer constants which are bound logically and (in C++) semantically together.

    enum Animals
    {
    Dog,
    Cat,
    Mouse,
    Horse,
    Elephant,
    // ...
    };

    enums are typesafe only on C++:

    Animals a = Cat;
    int i = a; // needs typecast in C++, not in C

    enums are real constants only in C++, the following is invalid in C:

    switch(a)
    {
    case Dog:
    break;
    case Cat:
    break;
    }

    I'll add if I come up with other things.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

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