digitalmars.D.learn - Multiline String Literals without linefeeds?
- John Carter (16/16) Sep 22 2013 In C/C++ in the presence of the preprocessor a string
- simendsjo (4/20) Sep 22 2013 If I'm not mistaken, this is exactly the way to do it.
- bearophile (12/19) Sep 23 2013 Genrally you should do:
- simendsjo (2/22) Sep 23 2013 Isn't "some" "string" replaced with "somestring" early on?
- bearophile (5/6) Sep 23 2013 Yes, unfortunately. And it's something Walter agreed with me to
- Dicebot (2/8) Sep 23 2013 Rationale / link to discussion? I use it extensively.
- bearophile (4/5) Sep 23 2013 http://d.puremagic.com/issues/show_bug.cgi?id=3827
- Dicebot (5/10) Sep 23 2013 Thanks.
In C/C++ in the presence of the preprocessor a string char foo[] = "\ long\ string\ without\ linefeeds\ "; Is translated by the preprocessor to char foo[] = "longstringwithoutlinefeeds"; is there a similar mechanism in D? Or should I do... string foo = "long" "string" "without" "linefeeds" ;
Sep 22 2013
On Monday, 23 September 2013 at 04:43:16 UTC, John Carter wrote:In C/C++ in the presence of the preprocessor a string char foo[] = "\ long\ string\ without\ linefeeds\ "; Is translated by the preprocessor to char foo[] = "longstringwithoutlinefeeds"; is there a similar mechanism in D? Or should I do... string foo = "long" "string" "without" "linefeeds" ;If I'm not mistaken, this is exactly the way to do it. A side note - Ds CTFE is quite good, so you can usually build up strings at compile-time using regular functions.
Sep 22 2013
John Carter:is there a similar mechanism in D? Or should I do... string foo = "long" "string" "without" "linefeeds" ;Genrally you should do: string foo = "long" ~ "string" ~ "without" ~ "linefeeds"; See also: http://d.puremagic.com/issues/show_bug.cgi?id=3827 You could also write a string with newlines and then remove them at compile-time with string functions. Bye, bearophile
Sep 23 2013
On Monday, 23 September 2013 at 09:42:59 UTC, bearophile wrote:John Carter:Isn't "some" "string" replaced with "somestring" early on?is there a similar mechanism in D? Or should I do... string foo = "long" "string" "without" "linefeeds" ;Genrally you should do: string foo = "long" ~ "string" ~ "without" ~ "linefeeds"; See also: http://d.puremagic.com/issues/show_bug.cgi?id=3827 You could also write a string with newlines and then remove them at compile-time with string functions. Bye, bearophile
Sep 23 2013
simendsjo:Isn't "some" "string" replaced with "somestring" early on?Yes, unfortunately. And it's something Walter agreed with me to kill, but nothing has happened... Bye, bearophile
Sep 23 2013
On Monday, 23 September 2013 at 11:10:07 UTC, bearophile wrote:simendsjo:Rationale / link to discussion? I use it extensively.Isn't "some" "string" replaced with "somestring" early on?Yes, unfortunately. And it's something Walter agreed with me to kill, but nothing has happened... Bye, bearophile
Sep 23 2013
Dicebot:Rationale / link to discussion? I use it extensively.http://d.puremagic.com/issues/show_bug.cgi?id=3827 Bye, bearophile
Sep 23 2013
On Monday, 23 September 2013 at 11:30:18 UTC, bearophile wrote:Dicebot:Thanks. Well, then we will have _guaranteed_ const-folding of adjacent concatenated string literals, I will be perfectly fine with this but it does not seem to be the case right now.Rationale / link to discussion? I use it extensively.http://d.puremagic.com/issues/show_bug.cgi?id=3827 Bye, bearophile
Sep 23 2013