flat assembler
Message board for the users of flat assembler.
Index
> Main > Size of an array |
Author |
|
shaolin007 21 Jun 2005, 20:56
Could someone show me example in FASM for getting the size of an array without manually calculating it each time?
Code: array db 20 dup (0) |
|||
21 Jun 2005, 20:56 |
|
Madis731 21 Jun 2005, 22:24
Just:
Code: array db 20 dup (0) sizearr = $-array ;or make it persistent sizearr dd $-array |
|||
21 Jun 2005, 22:24 |
|
shaolin007 21 Jun 2005, 22:36
Hmm tried that and it seemed to have a detrimental effect when passed to a function in my code.
|
|||
21 Jun 2005, 22:36 |
|
Tomasz Grysztar 21 Jun 2005, 22:52
Try the sample macro from section 2.3.4 of fasm's manual:
Code: struc db [data] { common . db data .size = $ - . } after such definition this code: Code: array db 20 dup (0) will define array.size constant with value 20. |
|||
21 Jun 2005, 22:52 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.