flat assembler
Message board for the users of flat assembler.

Index > Main > Single and double quotes

Author
Thread Post new topic Reply to topic
jorido



Joined: 23 Jan 2017
Posts: 53
jorido 24 Feb 2017, 16:48
Are double and single quotes equals? Can they be used interchangably?
Which are used most often?
Post 24 Feb 2017, 16:48
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20513
Location: In your JS exploiting you and your system
revolution 24 Feb 2017, 17:02
jorido wrote:
Are double and single quotes equals? Can they be used interchangably?
If you are asking about assembly source code for fasm then for the most part, yes.
jorido wrote:
Which are used most often?
Don't know. Popularity doesn't matter.
Post 24 Feb 2017, 17:02
View user's profile Send private message Visit poster's website Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 24 Feb 2017, 18:18
You can use double quotes if text contains single quotes and vice versa for convenience not to bother with escape sequences
Post 24 Feb 2017, 18:18
View user's profile Send private message Reply with quote
jorido



Joined: 23 Jan 2017
Posts: 53
jorido 25 Feb 2017, 01:06
>If you are asking about assembly source code for fasm then for the most part, yes.
Yes. Why for the most part, are there exceptions?
Post 25 Feb 2017, 01:06
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20513
Location: In your JS exploiting you and your system
revolution 25 Feb 2017, 02:13
jorido wrote:
Yes. Why for the most part, are there exceptions?
If you change the quote character then ...
  • They look different in an editor.
  • The files will hash to different values possibly affecting your SCM.
  • Concatenating things with macros may change the results.
  • Probably more things I can't think of right now.
Post 25 Feb 2017, 02:13
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8367
Location: Kraków, Poland
Tomasz Grysztar 25 Feb 2017, 10:07
revolution wrote:
[*]Concatenating things with macros may change the results.
Changing between single and double quotes has no effect on macros, because both methods lead to the creation of identical "quoted string" token and macros operate on tokens, not original text. The only real difference is the one mentioned by zhak, that you use can freely use a single quote inside a string enclosed with double ones, or vice versa.
Post 25 Feb 2017, 10:07
View user's profile Send private message Visit poster's website Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc 25 Feb 2017, 11:49
Tomasz Grysztar wrote:
The only real difference is the one mentioned by zhak

Well, another difference is that the single quote is allowed in numeric symbols, while the double quote is not, although none of these forcefully starts a new symbol and both can therefore be freely used in non-leading positions of other symbols such as constant names. They are treated then as different characters, of course (a"b = 1 defines a constant other than a'b = 1).

P.S. And the string-enclosing quote can also be used inside the string if put twice in succession.

_________________
Faith is a superposition of knowledge and fallacy
Post 25 Feb 2017, 11:49
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.