SPONSORS:






User Tag List

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    May 2001
    Location
    New Delhi , India
    Posts
    28
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is there any 4Test function to return the size of any data type?

    Hi All,

    I want to get to know the total size of a compound data type say e..g a record which is declared as below :
    type MEMORY_STATUS is record
    {
    DWORD dwLength;
    DWORD dwMemoryLoad;
    DWORDLONG ullTotalPhys;
    DWORDLONG ullAvailPhys;
    DWORDLONG ullTotalPageFile;
    DWORDLONG ullAvailPageFile;
    DWORDLONG ullTotalVirtual;
    DWORDLONG ullAvailVirtual;
    DWORDLONG ullAvailExtendedVirtual;
    }

    We have one funtion in C - sizeof ( ) , do we have some thing similar in 4Test?

    If not a in-built function , some work around to this problem , as I am required to pass the total size of the compound data types oftenly in Win32 API calls.

    This is ****** and any help would be greatly appreciated.

    Thanks,

    Grover.

    ------------------

  2. #2
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Is there any 4Test function to return the size of any data type?

    I think you could probably code it yourself, with something like the following:
    I believe the sizeof() function is necessary in C because the size of one datatype can vary across platforms. Silktest only runs on 32-bit windows, so you can code this a lot more easily (assuming that you do know the relevant memory sizes of the simple data types).

    ------------------


    [This message has been edited by vincebowdren (edited 06-12-2001).]

  3. #3
    Junior Member
    Join Date
    May 2001
    Location
    New Delhi , India
    Posts
    28
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Is there any 4Test function to return the size of any data type?

    I tried this before , but it seems that it is not working for me (.

    When executing this line :

    LIST OF ANYTYPE lsFields = FieldsOfRecord (TypeOf (MemoryStatus));

    the return values is always of the type "STRING" and hence the switch statement does not get into INT or DWORD....

    Any help in this regards would be highly appreciated.

    Thanks,

    Grover.

    ------------------

  4. #4
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Is there any 4Test function to return the size of any data type?

    This works:



    ------------------

  5. #5
    Member
    Join Date
    Aug 2002
    Location
    Durham, NC USA
    Posts
    60
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Is there any 4Test function to return the size of any data type?

    I know this topic is ancient, but I'd like to resurrect it, since I'm trying to do a similar thing.

    I'd appreciate very much some constructive criticism of my SizeOf function. It's not as robust as C, of course, but I'd like to know if my guesses for data sizes were appropriate, if it will work in all cases, if there are other common datatypes I will wish I had included, etc...
    <PRE>
    [-] INTEGER SizeOf(ANYTYPE aMagicList)
    [ ] INTEGER iCount=0
    [ ] INTEGER iCount2=1
    [-] switch TypeOf(aMagicList)
    [-] case BOOLEAN
    [ ] iCount+=1
    [-] case INTEGER
    [ ] iCount+=4
    [-] case REAL
    [ ] iCount+=8
    [-] case STRING
    [ ] iCount+=Len(aMagicList[iCount2])+1
    [ ] //iCount+=16384 // does it require all possible size for the string?
    [-] case LIST
    [ ] iCount+=4 // 32 bit pointers?
    [-] for iCount2=1 to ListCount(aMagicList)
    [ ] iCount+=SizeOf(aMagicList[iCount2])
    [ ] return iCount
    </PRE>
    Thanks in advance!

    Sincerely,
    Timothy Crone
    Assoc. Hardware Engineer
    Lvl7 Systems, Inc.


    [This message has been edited by tdcrone (edited 08-27-2002).]
    --
    Tim Crone
    Broadcom

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:42 PM.

Copyright BetaSoft Inc.