Qbasicnews.com

Full Version: Integer and Longs
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Victor, hi @ll,
regarding data types, I've seen that INTEGER and LONG is accepted for the same thing.
IMHO it would be nicer if you would stick with INTEGER and use LONG for machine (os?) dependable size.

I worked with XBasic/XBlite, and there XLONG is 32bit or 64bit, depending on the machine ( natural CPU integer ). This is very nice because some stuff on Windows act that way. (Like Window-hWnd's on Win9x and WinNT&up or a Function addresses ...)
Don't know about Linux/BCD etc. though...

Don't ask me how it's done inside the compiler, I don't know.

I'm saying this because I'm in the process of porting kernel32 include file from XBlite to fb, and where I find XLONG (so called natural long - machine dependend) I change it to long (so it could be 32bit or 64bit depending on cpu) and if you would consider to use my suggestion you could.

SLONG (fixed 32bit) will be changed to INTEGER and ULONG (fixed 32bit) to UINTEGER.

What do you guy's think?
On the same topic:
this structure has GIANTs (XBasic's 64bit integer). What do I do with that?
Code:
(XBASIC syntax)
Type MEMORYSTATUSEX
  ULONG  .dwLength
  ULONG  .dwMemoryLoad
  GIANT  .ullTotalPhys
  GIANT  .ullAvailPhys
  GIANT  .ullTotalPageFile
  GIANT  .ullAvailPageFile
  GIANT  .ullTotalVirtual
  GIANT  .ullAvailVirtual
  GIANT  .ullAvailExtendedVirtual
End Type
To make things easier, there is a list of data types on this site.

But I'm curious - why not just port the C version? It's keywords would be better named than XB. Tongue
I know this site (actual I have more than that...)

The question wasn't regarding XBasic.

It was because XBasic's GIANT is a 64bit integer and FreeBasic doesn't have a 64bit integer :wink:

Besides in C it's a DWORDLONG:
Code:
typedef struct _MEMORYSTATUSEX {
    DWORD dwLength;
    DWORD dwMemoryLoad;
    DWORDLONG ullTotalPhys;
    DWORDLONG ullAvailPhys;
    DWORDLONG ullTotalPageFile;
    DWORDLONG ullAvailPageFile;
    DWORDLONG ullTotalVirtual;
    DWORDLONG ullAvailVirtual;
    DWORDLONG ullAvailExtendedVirtual;
} MEMORYSTATUSEX, *LPMEMORYSTATUSEX;


The structure above needs 64bit integer, that's the whole point of my post :o
There's no support for 64-bit integers, sorry.. would need a library for do all the math, if anyone knows a LGPL and portable 64-bit math lib.. LONGLONG types? er..
Well, here is a very interesting 128-bit integer emulator:
http://cvs.sourceforge.net/viewcvs.py/co....c?rev=1.6