flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Main > Single and double quotes

Author
Thread Post new topic Reply to topic
jorido



Joined: 23 Jan 2017
Posts: 40
Single and double quotes
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: 15096
Location: The Unicomplex
Re: Single and double quotes

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: 473
Location: Belarus
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: 40
>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: 15096
Location: The Unicomplex

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
Assembly Artist


Joined: 16 Jun 2003
Posts: 6518
Location: Kraków, Poland

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: 875

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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.