sizeOf (Struct, Variable, Interface)

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
benny
Enthusiast
Enthusiast
Posts: 465
Joined: Fri Apr 25, 2003 7:44 pm
Location: end of www
Contact:

sizeOf (Struct, Variable, Interface)

Post by benny »

In the german forum we discussed the following problem:

Code: Select all

Structure TestStruc
  a.l
  b.w
  c.b
EndStructure

test.TestStruc
Debug SizeOf(TestStruc)
Debug SizeOf(test)

TestStruc.POINT
Debug SizeOf(TestStruc)
As you can see, the last sizeOf command returns the size of the
structure TestStruc and not of the Variable TestStruc.POINT.

In C for example, you use something like these to distinguish between the
name of a structure and the name of a variable:

sizeOf (struct TestStruc) ; returns the size of the structure
sizeOf (TestStruc) ; returns the size of the variable TestStruc (.point)

So, it would be cool if there would be a syntax like the following suggested
by MVXA:
sizeof(TestStruc)
sizeof(TestStruc, #PB_Variable)
sizeof(TestStruc, #PB_Structure)
sizeof(TestStruc, #PB_Interface)
Allowing sizeOf with no parameter guarantees compatibility to
old code.
regards,
benny!
-
pe0ple ar3 str4nge!!!
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Look:
viewtopic.php?t=8262
There karbon had the idea, i repeated it, and Fred said it was good.
What happened with that, Fred :?:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
benny
Enthusiast
Enthusiast
Posts: 465
Joined: Fri Apr 25, 2003 7:44 pm
Location: end of www
Contact:

Post by benny »

@Psychophanta:

Thanks for the link and sorry for the double posting.



@Fred:

Take your time. This isn't very urgent IMHO. But maybe you could think about
adding this on your to-do-list ;-)
regards,
benny!
-
pe0ple ar3 str4nge!!!
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

sizeOf (Struct, Variable, Interface)

Post by fsw »

benny wrote:@Psychophanta:
Thanks for the link and sorry for the double posting.
You don't have to be sorry for the double posting - the link is from 2003 :shock:
benny wrote: @Fred:
Take your time. This isn't very urgent IMHO.
But maybe you could think about adding this on your to-do-list ;-)
What about that?

Code: Select all

ToDoList = (NewFunctions + BugFixes) - SizeOf(TakeYourTimeFred)
:lol:
benny
Enthusiast
Enthusiast
Posts: 465
Joined: Fri Apr 25, 2003 7:44 pm
Location: end of www
Contact:

Re: sizeOf (Struct, Variable, Interface)

Post by benny »

fsw wrote: What about that?

Code: Select all

ToDoList = (NewFunctions + BugFixes) - SizeOf(TakeYourTimeFred)
:lol:
:lol: I just wanted to do a reverse psychological trick. Everyone demands
bugfixed and new functions as soon as possible from Fred. I tried it the other
way around by saying "Take your time, Fred".

Well ... it was just a try - will see if it works ;-)
regards,
benny!
-
pe0ple ar3 str4nge!!!
Post Reply