Skip to main content
GameDev.net gamedev.net
🔒 Locked

static vars in code segment???

Started by JD Sep 14, 2000 at 5:20 PM 1 replies 400+ views
Original Post
JD
JD
In VC++ compiler are the static variables placed inside the code segment? The reason I''m asking is because I recently read pass32 assembler notes and it places static vars into code segment. If that''s true then I was wrong thinking that static vars are placed in special part of the data segment. Just want to know what''s going on behind the curtains. Thanks my homepage E-Mail: BlueOrbSoftware@mailcity.com
baskuenen
baskuenen
I think your first thought was true

Placing static vars in the code segment is very bad, because it can destroy your code cache resulting in speed loss.

They should be placed in that special data-segment.

On the other hand, some read-only vars are sometimes places in the code segment. The jump-addresses needed for the switch/case instructions for example.

JD
JD
Thank you baskuenen

I reread pass32 notes and found out that it places constant vars into code segment like you''ve said. My mistake... sorry. (note to myself: static vars belong in special location in data segment) Thank you

Topic Locked

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

Sign in to reply to this topic.