Quick question on Enum's data type

General FreeBASIC programming questions.
mrToad
Posts: 430
Joined: Jun 07, 2005 23:03
Location: USA
Contact:

Re: Quick question on Enum's data type

Post by mrToad »

MrSwiss wrote:
mrToad wrote:I don't remember if there's a formal word for UDT items ...
The word you are looking for, is: type member ...
Thank you. That will help me sound less confusing.

@fxm, That's right, of course. I recall Properties from Visual Basic. I used to code VB for years and later the word Properties got into my head for my Types somehow.

One thing that comes to mind now, I don't think FB had as much capability for object oriented coding back when I made that GUI.
fxm
Moderator
Posts: 12082
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Quick question on Enum's data type

Post by fxm »

mrToad wrote: One thing that comes to mind now, I don't think FB had as much capability for object oriented coding back when I made that GUI.
It all depends when you have coded your GUI.
mrToad
Posts: 430
Joined: Jun 07, 2005 23:03
Location: USA
Contact:

Re: Quick question on Enum's data type

Post by mrToad »

fxm wrote:
mrToad wrote: One thing that comes to mind now, I don't think FB had as much capability for object oriented coding back when I made that GUI.
It all depends when you have coded your GUI.
Yea, I couldn't remember before. Now I found that I posted the original version in 2010:
https://www.freebasic.net/forum/viewtopic.php?p=132886

Edit:
It has improved since then. Actually I have an OpenGL version too.
When I read some replies, it was nice to see it worked in Linux also.
It's been so long I forgot that a lot of people have already tested it.

Maybe I will fix the download and upload to the latest version, or post it in a fresh thread.
fxm
Moderator
Posts: 12082
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Quick question on Enum's data type

Post by fxm »

Code: Select all

Union Block
    Enum Shapes
        circle = 1
        square
        triangle
    End Enum
    As Byte Shape
End Union

Print Sizeof(Block.Shapes)  '' 4 (in 32-bit) or 8 (in 64-bit)
Print Sizeof(Block)         '' 1
@admin,
Perhaps a special case to be treated to prohibit a Sizeof (or Len) evaluation of a nested Enum named in a Type (or Union).
Post Reply