POV-Ray : Newsgroups : povray.programming : enum { SOMETHING = 'Thing' } ? : Re: enum { SOMETHING = 'Thing' } ? Server Time
5 Jul 2024 15:09:33 EDT (-0400)
  Re: enum { SOMETHING = 'Thing' } ?  
From: Thorsten Froehlich
Date: 6 Feb 2004 08:13:45
Message: <40239309@news.povray.org>
In article <402364bb$1@news.povray.org> , "AngleWyrm" 
<no_### [at] hotmailcom> wrote:

>> No, nobody would define enums and then not use them.
>
> Have you seen these enum values used somewhere?
> This is what I have gone looking, and haven't found them used anywhere.

Well, as has been pointed out, you have to search for the enum names, not
their values.  As they are used by POVMS messages, look into the code
sending and receiving POVMS messages.

>> Enums are given "names" because those mean more to a human when debugging.
>
> Doesn't your debugger display enums directly?

Most high-level debbuggers do display enums directly, yes.  However,
low-level debuggers don't, and neither do queue/network loggers.  Thus, if
doing IPC, you quickly learn to appreciate being able to read what is going
on.

> enum CRITTERS {CAT, DOG, MOUSE};
> CRITTERS animal = CAT;
> debugger says:" animal = CAT " which is plenty clear enough.
> And this works for any external program that uses the header file in which
> the enum is defined.

Yes, but is does not work well if you ever want to *extend* the enum.  You
quickly end up with hard to find bugs or having to recompile all external
programs every time some extension is made, even if that extension is not
used by the external program at all.

> What is gained by saying the variable 'animal', which has a value of CAT,
> also has a numerical value that can be translated to 'cat'?

See what I outlined above.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.