Size of variables in bit (or bytes)

Discussion about recent product features & solutions!
4 posts • Page 1 of 1
eMichx
Posts:64
Joined: Thu Apr 24, 2014 11:24 am

Size of variables in bit (or bytes)

Post by eMichx »

Hello,

I'm looking for a function which will return the size of a any variable (anytpe, char, bool, dyn_xxx, blob)
in bits or in bytes.
I have found nothing in the help or in ctl scripts of WinCCOA.

best regards
Emmanuel

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Size of variables in bit (or bytes)

Post by leoknipp »

Hello,

can you please describe what the usecase would be for such a function?
What is done with the result?

An anytype variable does not have a fixed size. How many bytes are needed depends on the value saved in the anytype variable. It is the same for the other variables.

Best Regards
Leopold Knipp
Senior Support Specialist

eMichx
Posts:64
Joined: Thu Apr 24, 2014 11:24 am

Re: Size of variables in bit (or bytes)

Post by eMichx »

Hi

I'm using blob to insert value, but trying to optimize the length.
For example, add 8 bits to create a bytes, to avoid using a byte
to encode a symple bit.
When you have an unsigned, sometimes it's interesting to
encode it to N bits (N

Gertjan van Schijndel
Posts:634
Joined: Mon Aug 02, 2010 10:37 am

Re: Size of variables in bit (or bytes)

Post by Gertjan van Schijndel »

In the online help under CONTROL -> Introduction CONTROL -> Data types you can find the sizes of the fixed size variable types.

4 posts • Page 1 of 1