flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > is <'testing',0> auto prepend 0 byte?

Author
Thread Post new topic Reply to topic
sleepsleep



Joined: 05 Oct 2006
Posts: 12737
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 09 Feb 2013, 15:01
hi,
is using <'my string',0> auto prepend 0 byte?

should i use <'mystring'> instead of <'mystring',0>

thank you.
Post 09 Feb 2013, 15:01
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 09 Feb 2013, 16:37
What macro library?
Post 09 Feb 2013, 16:37
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 618
cod3b453 09 Feb 2013, 19:01
To prepend would be <0,'my string'> to append would be <'my string',0>; the second case is what you'd use for null terminated strings.
Post 09 Feb 2013, 19:01
View user's profile Send private message Reply with quote
Asm++



Joined: 04 Feb 2013
Posts: 24
Location: On a Chip!
Asm++ 09 Feb 2013, 19:34
sleepsleep wrote:
hi,
is using <'my string',0> auto prepend 0 byte?

should i use <'mystring'> instead of <'mystring',0>

thank you.

Well, It depends on the operations you're doing on them and the libraries you're using, but here is a general rule, if the string have a Known length and a defined starting point then No need for the 0, else use the 0 at the end of the string(this way is more flexible than the fist, specially if you're working on Windows or using C's library), so I prefer using <'MySting', 0> over <'MySting'> in most cases.

_________________
Binary is nice, but Assembly is better!
Post 09 Feb 2013, 19:34
View user's profile Send private message Reply with quote
ASM-Man



Joined: 11 Jan 2013
Posts: 64
ASM-Man 09 Feb 2013, 19:58
Asm++ wrote:
sleepsleep wrote:
hi,
is using <'my string',0> auto prepend 0 byte?

should i use <'mystring'> instead of <'mystring',0>

thank you.

Well, It depends on the operations you're doing on them and the libraries you're using, but here is a general rule, if the string have a Known length and a defined starting point then No need for the 0, else use the 0 at the end of the string(this way is more flexible than the fist, specially if you're working on Windows or using C's library), so I prefer using <'MySting', 0> over <'MySting'> in most cases.


I agree,but here seems a special case, the < > is macro of library that (so far) we don't know how is implemented. Such macro can expand to put a 0-byte at end-of-string,it's want to he know. By reading the doucumentaion is only way to know.

_________________
I'm not a native speaker of the english language. So, if you find any mistake what I have written, you are free to fix for me or tell me on. Smile
Post 09 Feb 2013, 19:58
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.