tags:

views:

31

answers:

2

How important are section/segment directives? I've noticed that they are usually optional. Also, I've noticed that the output size changes when you do or do not include them.

I'm using NASM, if that helps.

+2  A: 

These are mostly hints to the linker. For the newer architectures you can pretty much ignore them, unless you have very specific memory management requirements. For older 16-bit code they are very essential.

Vlad
Thanks for the quick reply :)
someguy
+1  A: 

They are very important because if you save your strings in the Code segment the program could execute much slower and the Strings blow up the data in the Instruction cache.

If you create a Library(.lib or something like that) it is also important because you don't wan't data (strings) to lay directly behind your executable instructions because of the reasons above.

Quonux
Hmm... this makes sense I guess. I've decided to use them for readability reasons anyway. Thanks, I'll mark this is as the accepted answer 'til further notice.
someguy