Author Topic: Short global variables  (Read 10786 times)

jj2007

  • Member
  • *****
  • Posts: 8822
  • Assembler is fun ;-)
    • MasmBasic
Re: Short global variables
« Reply #15 on: July 24, 2012, 09:00:31 AM »
Just out of curiosity, what file system/cluster size do you use?
He has create his own FS that allows a cluster size of 1 Byte - the days of oversized and byte wasting clusters are over  :biggrin:
Nice!  His file system uses a cluster size of 1/512 of a sector!

Hutch,

Could you please move these posts to their proper place? Afterwards, please delete this one (by the way: the old forum used to have a delete button - where is it gone?)

Thanks.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5894
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Short global variables
« Reply #16 on: July 24, 2012, 10:17:36 AM »
No need, the Workshop is a place for general discussion and many topics wander from their original subject.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

Ryan

  • Guest
Re: Short global variables
« Reply #17 on: July 24, 2012, 11:45:15 AM »
My apologies.  I was trying to get a feeling for pros and cons.  I got a bit carried away.  I'm sorry.

Antariy

  • Member
  • ****
  • Posts: 544
Re: Short global variables
« Reply #18 on: July 24, 2012, 12:29:28 PM »
Jochen, it's cute technique simplifying the code readability, besides it could have its use, for instance, in an inner loops of some heavy multithreaded apps (for accessing global vars controlling the threads each from another) :t

jj2007

  • Member
  • *****
  • Posts: 8822
  • Assembler is fun ;-)
    • MasmBasic
Re: Short global variables
« Reply #19 on: July 24, 2012, 12:36:50 PM »
Jochen, it's cute technique simplifying the code readability, besides it could have its use, for instance, in an inner loops of some heavy multithreaded apps (for accessing global vars controlling the threads each from another) :t

Thanks, Alex, that could indeed be the most interesting application for this technique.

@Ryan: Thanks for the clarification :icon14:

dedndave

  • Member
  • *****
  • Posts: 8808
  • Still using Abacus 2.0
    • DednDave
Re: Short global variables
« Reply #20 on: July 25, 2012, 08:04:39 AM »
it can do a lot for you

if you look at the structures i posted earlier, you will see that i have horz and vert scroll info structs
i use the same code for both axis
at the beginning, i just grab a pointer into the structure
if it is horz scroll, the scroll info struct is right there
if it is vert scroll, i add the struct size and - bang - i am pointing at vert scroll info
then - both use the same code

again - with the handles...
when the child windows and controls are created in a loop, the handles fill the structure
in WM_SIZE, i use an index into the handle struct to adjust window/control sizes and positions

so - it saves more than a few bytes   :t

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: Short global variables
« Reply #21 on: July 25, 2012, 08:09:59 AM »
so - it saves more than a few bytes   :t

Dave,

good point and a really cool technique. :t

Gunther
Get your facts first, and then you can distort them.