Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / No Data in Variables

Author
Message
Vandetta
23
Years of Service
User Offline
Joined: 17th Dec 2002
Location:
Posted: 23rd Oct 2003 23:37
Is it possible to set a variable to nothing, not 0, but nothing. So a variable wouldnt take up memory until its needed?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 23rd Oct 2003 23:46
Nope. The nearest you can get is with arrays - don't dim the array until you need it - but even then, it'll take up a massive ... 4 bytes
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Oct 2003 10:47
NULL?
OSX Using Happy Dude
22
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 24th Oct 2003 12:18
Still takes a byte (or 4)


Avatar & Logo by Indi. Insert witty comment here...
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Oct 2003 12:23
A variable will take up space -

Integers, floats and dwords will always use 4 bytes
long integers and long floats will always use 8 bytes
strings and arrays will always use a *minimum* of 4 bytes

However, only global variables (outside of functions) allocate that memory immediately. Variables inside functions are allocated on-the-fly (at an almost zero cost), but the space is returned when control returns from the function.

Login to post a reply

Server time is: 2026-07-26 15:30:36
Your offset time is: 2026-07-26 15:30:36