Obtaining an address given a (run time) variable name
    matheus 
    matheus at gmail.com
       
    Tue Jan 21 20:26:53 UTC 2025
    
    
  
On Tuesday, 21 January 2025 at 09:34:29 UTC, DLearner wrote:
> ...
> Suppose we have:
> ```
> string str1 = "A" ~ "B";
> ```
>
> Does that produce:
>    str1 == x'41' x'42' x'00' or
>         == x'41' x'00' x'42' x'00' or
>         == x'41' x'00' x'42' x'00' x'00'?
>
> And is str1.length == 2 or
>                    == 3 or
>                    == 4?
void main() {
   string str1 = "A" ~ "B";
   static string s =  "CD";
}
.L.str:
         .asciz  "AB"
immutable(char)[] example.main().s:
         .quad   2
         .quad   .L.str.1
.L.str.1:
         .asciz  "CD"
LDC (GDC seems pretty close).
https://godbolt.org/z/hjn3qKE19
Matheus.
    
    
More information about the Digitalmars-d-learn
mailing list