Skip to main content
gamedev.net
🔒 Locked

Initialised Data and Uninit' Data

Started by cyberben 0 replies 250+ views
Original Post
cyberben
cyberben
Hi there, I''m using Masm32 (assembler) however I believe the same concepts are true in other programming languages. In Masm there are two sections to declare your variables: .data and .data? .data is the intialised data and the other is uninitialised data. From my understanding Initialised data has it''s values stored within the executable. So a string with a value of "Hello" would take up 5 or more bytes within the executable. At load time the program will allocate the 5 bytes and put that value into the variable hence it''s initialised.. Now for the unitialised data my understanding is that NO value at all not even NULL or 0 is saved within the executable, so it doesn''t take up more space and at load time the size requested is allocated but is not initialised so the values remain whatever it was before my use, could be anything no guarentees. Hence you should initialise it by seting it to 0 or NULL. Is this correct? If not please correct me! Thanks, Ben
__________________________Mencken's Law:"For every human problem, there is a neat, simple solution; and it's always wrong."
"Computers in the future may weigh no more than 1.5 tons."- Popular Mechanics, forecasting the relentless march of science in 1949
Qoy
Qoy
Yes, that''s correct from everything I''ve heard.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.