printf, writeln, writefln

Salih Dincer salihdb at hotmail.com
Thu Dec 8 19:32:19 UTC 2022


On Thursday, 8 December 2022 apt 17:39:58 UTC, Ali Çehreli wrote:
> > ```d
> > void stringCopy(Chars)(string source,
> >                      ref Chars target)
> >
> >    sample.stringCopy = cTxt;  // disappeared ? char
> > ```
> I find the expression above extremely confusing. I am used to 
> assignment expression changing the value of the left hand side, 
> but that expression changes cTxt.

You're right, it's my fault. Copy commands are always used as 
source on the left and target on the right. I have to get rid of 
this habit. Immediately I'm swapping parameters and fixing...

```d

   stringCopy(cText, sample); // or
   cText.stringCopy(sample):  // or
   cText.stringCopy = sample; // tricky 😀
```

@SDB79


More information about the Digitalmars-d-learn mailing list