Re: dmd for Haiku OS

2022-10-31 Thread Brian Callahan via Digitalmars-d-learn

On Monday, 31 October 2022 at 17:31:58 UTC, Sergey wrote:


Story about porting to OpenBSD:
https://briancallahan.net/blog/20210320.html



Following up on my own blog post, I would definitely recommend 
using GCC 11.2 as the version to use to bootstrap GDC to Haiku. I 
think that's the last one before the move to GDC being written in 
D. Once you've made the bootstrap GDC, then move to the latest 
release (12.2) and you can continue moving forward with that as 
new releases are made.


~Brian


Re: Write UTF-8 bytes directly to stack buffer

2022-03-13 Thread Brian Callahan via Digitalmars-d-learn

On Sunday, 13 March 2022 at 07:55:01 UTC, Chris Piker wrote:


Hey thanks!  That does work with recent versions of dmd+phobos, 
but doesn't work in gdc-10.  For some reason it produces this 
error:


```d
error: static assert  "Cannot put a const(char)[] into a 
char[]."

```

Is there a work around involving `.representation` as alluded 
to in this 
[thread](https://forum.dlang.org/post/zmehmpithifbgfuef...@forum.dlang.org) ?


To get around the issue I built gdc-11.2 from source code at 
the GNU site but the old version of phobos is still included, 
so no dice.


Build the latest gdc snapshot: 
https://mirrors.concertpass.com/gcc/snapshots/12-20220306/


~Brian


Re: how to print "111000" out into 0b111000

2022-01-19 Thread Brian Callahan via Digitalmars-d-learn

On Wednesday, 19 January 2022 at 15:01:29 UTC, michaelbi wrote:

as captioned... thx.


```d
import std.stdio;
import std.conv;

void main()
{
writefln("0b%b", to!int("111000", 2));
}
```


Re: Possible runtime bug in preprocessing of command line arguments passed to the D main

2021-10-24 Thread Brian Callahan via Digitalmars-d-learn

On Sunday, 24 October 2021 at 14:38:44 UTC, jfondren wrote:


With nothing to the contrary, I'd take "must be terminated by a 
null pointer" as "can't itself be a null pointer".




The execve(2) is more explicit:
"The argument argv is a pointer to a null-terminated array of 
character pointers to NUL-terminated character strings. These 
strings construct the argument list to be made available to the 
new process. At least one non-null argument must be present in 
the array; by custom, the first element should be the name of the 
executed program (for example, the last component of path)."