On Monday, 25 January 2021 at 10:33:14 UTC, Mike Parker wrote:
On Monday, 25 January 2021 at 09:16:11 UTC, Rempas wrote:
For printf() we can use this format `"%.*s", cast(int)s
s.length, s.ptr`. When trying to use the same for scanf(), it
says that this specifier is invalid.
The * has a
Actually what the title says. For example I have dchar c =
'\u03B3'; and I want to make it into string. I don't want to use
"to!string(c);". Any help?
On Monday, 25 January 2021 at 18:28:09 UTC, Ferhat Kurtulmuş
wrote:
On Monday, 25 January 2021 at 17:38:21 UTC, Rempas wrote:
On Monday, 25 January 2021 at 10:33:14 UTC, Mike Parker wrote:
[...]
Thanks! Actually for some reason. It won't accept a
char[size]. I created a heap allocated (with
Sorry if that's a stupid question but I've read
[this](https://dlang.org/spec/betterc.html) post that talks about
betterC but I didn't understand where betterC is being used and
what are the advantages it gives. Can anyone help me out with
this?
On Tuesday, 19 January 2021 at 18:04:42 UTC, Adam D. Ruppe wrote:
On Tuesday, 19 January 2021 at 17:44:03 UTC, Rempas wrote:
Oh ok! So there is not advantage from using it like faster
compile time, better performance etc. right?
The default betterC build will compile about a quarter second
On Tuesday, 19 January 2021 at 17:40:52 UTC, Adam D. Ruppe wrote:
betterC is a niche restricted feature set. If you don't already
have a use case in mind, I'd recommend avoiding it.
It is for cases where you're stuck with certain limitations to
integrate with the outside world. Like running
For printf() we can use this format `"%.*s", cast(int)s s.length,
s.ptr`. When trying to use the same for scanf(), it says that
this specifier is invalid.
I've read the documentation about DUB's config (I'm using the SDL
format) and it seems that DUB completely ignores my config. My
config file is:
```
name "test"
description "Testing dub"
authors "rempas"
copyright "Copyright © 2021, rempas"
license "AGPL-3.0"
compiler "ldc2"
configuration
On Sunday, 23 May 2021 at 15:00:37 UTC, Steven Schveighoffer
wrote:
The "build types" section is saying what the EQUIVALENT build
types are when passing on command line.
[...]
This will do it! Thanks a lot!
On Sunday, 23 May 2021 at 09:45:06 UTC, Guillaume Piolat wrote:
On Saturday, 22 May 2021 at 20:28:56 UTC, rempas wrote:
[...]
Hello,
DUB has two separate concepts:
[...]
Thanks a lot man!
On Sunday, 23 May 2021 at 04:56:18 UTC, Mike Parker wrote:
I just looked in the dub documentation for "build" and
"compiler" entries, which I had never heard of, and I see none
now. As Jordan said, those have always been configured on the
command line. Did you perhaps see something about those
On Sunday, 23 May 2021 at 00:36:48 UTC, Jordan Wilson wrote:
On Saturday, 22 May 2021 at 20:28:56 UTC, rempas wrote:
[...]
Ignoring the "dubug" typo...normally, I think you pass compiler
values directly to dub via the ```--compiler``` flag. For
example:
```shell
dub --config=development
On Friday, 9 July 2021 at 08:18:51 UTC, Ferhat Kurtulmuş wrote:
On Friday, 9 July 2021 at 08:08:57 UTC, rempas wrote:
I just wonder if I'm able to do system calls directly from D
or If I have to create bindings from "unistd.h" from C
I don't know if it covers what you want but, druntime has
On Friday, 9 July 2021 at 07:38:50 UTC, Mike Parker wrote:
On Friday, 9 July 2021 at 07:21:06 UTC, rempas wrote:
When I execute it, I'm getting a range violation error. If I
try to set "len" to be the length of the "prompt" minus 1,
then it will work and it will print the "prompt" until the
On Friday, 9 July 2021 at 07:54:44 UTC, zjh wrote:
On Friday, 9 July 2021 at 07:21:06 UTC, rempas wrote:
I have the following code:
`prompt[i]!='{'`,here,i=len.so `array overflow`
Thanks a lot. It seems I have a lot to learn. Have an amazing day!
On Friday, 9 July 2021 at 08:28:25 UTC, Dennis wrote:
On Friday, 9 July 2021 at 08:08:57 UTC, rempas wrote:
I just wonder if I'm able to do system calls directly from D
or If I have to create bindings from "unistd.h" from C
If with directly means 'without calling any C function' you can
use
I just wonder if I'm able to do system calls directly from D or
If I have to create bindings from "unistd.h" from C
On Friday, 9 July 2021 at 15:11:38 UTC, Steven Schveighoffer
wrote:
On 7/9/21 10:51 AM, rempas wrote:
The file can be found quickly
[here](https://github.com/dlang/druntime/blob/master/src/core/sys/posix/unistd.d) or in your system if you want. Now the question is, why isn't there an "open"
On Friday, 9 July 2021 at 15:31:50 UTC, Dennis wrote:
On Friday, 9 July 2021 at 15:11:38 UTC, Steven Schveighoffer
wrote:
But reading/writing, closing these file descriptors is always
the same.
For sockets you'd typically use `recv` and `send` instead or
`read` and `write` because the former
On Friday, 9 July 2021 at 15:04:32 UTC, rikki cattermole wrote:
On 10/07/2021 2:51 AM, rempas wrote:
The file can be found quickly
[here](https://github.com/dlang/druntime/blob/master/src/core/sys/posix/unistd.d) or in your system if you want. Now the question is, why isn't there an "open"
The file can be found quickly
[here](https://github.com/dlang/druntime/blob/master/src/core/sys/posix/unistd.d) or in your system if you want. Now the question is, why isn't there an "open" function for the equivalent system call? "close", "write", "read" etc. all exist. Anyone knows what's going
On Friday, 9 July 2021 at 15:37:41 UTC, Ali Çehreli wrote:
On 7/9/21 8:31 AM, rempas wrote:
> I searched "fnctl" in the repo [...] Probably made a typo
Yes, the typo should be obvious to the non-dyslexic among us. :)
fnctl <-- wrong
fcntl <-- correct
Ali
Lol, I'm not dyslexic (or at least
On Friday, 9 July 2021 at 11:56:40 UTC, Ali Çehreli wrote:
In addition to what others said, you can take advantage of
ranges to separate concerns of filtering and iteration. Here
are two ways:
[...]
Of course another help from the legend himself ;) As always
thanks a lot and have an
I have the following code:
```
import core.stdc.stdio;
void print(T)(string prompt, T args...) {
size_t len = prompt.length;
size_t i = 0;
while (prompt[i] != '{' && i < len) {
printf("%c", prompt[i]);
i++;
}
}
void main() {
print("Hello, world!\n", 10);
}
```
When I
On Friday, 9 July 2021 at 20:54:21 UTC, Paul Backus wrote:
On Friday, 9 July 2021 at 20:43:48 UTC, rempas wrote:
I'm reading the library reference for
[core.time](https://dlang.org/phobos/core_time.html#Duration)
and It says that the duration is taken in "hnsecs" and I
cannot understand if we
I'm reading the library reference for
[core.time](https://dlang.org/phobos/core_time.html#Duration) and
It says that the duration is taken in "hnsecs" and I cannot
understand if we can change that and choose the precision. Does
anyone know if we can do that?
On Friday, 9 July 2021 at 21:04:42 UTC, Ali Çehreli wrote:
On 7/9/21 1:54 PM, Paul Backus wrote:
[...]
Yes but the resolution seems not to be better than 100 nsecs. A
quick research reveals a better resolution is not possible with
common hardware on at least Linux.
The following program
On Sunday, 15 August 2021 at 07:43:59 UTC, jfondren wrote:
```d
unittest {
pragma(msg, typeof("John")); // string
pragma(msg, is(typeof("John") == immutable(char)[])); //
true
}
```
Still don't know what "pragma" does but thank you.
```d
void zerort(string s) {
On Sunday, 15 August 2021 at 08:17:47 UTC, rikki cattermole wrote:
pragma is a set of commands to the compiler that may be
compiler specific.
In the case of the msg command, it tells the compiler to output
a message to stdout during compilation.
Thanks man!
On Sunday, 15 August 2021 at 08:47:39 UTC, jfondren wrote:
dup() isn't aware of the NUL since that's outside the slice of
the string. It only copies the chars in "John". You can use
toStringz to ensure NUL termination:
https://dlang.org/phobos/std_string.html#.toStringz
Is there something
On Sunday, 15 August 2021 at 08:53:50 UTC, Tejas wrote:
External C libraries expect strings to be null terminated, so
if you do use `.dup`, use `.toStringz` as well.
Yeah, yeah I got that. My question is, if I should avoid
`cast(char*)` and use `.toStringz` while both do the exact same
On Sunday, 15 August 2021 at 09:01:17 UTC, jfondren wrote:
They don't do the same thing. toStringz always copies, always
GC-allocates, and always NUL-terminates. `cast(char*)` only
does what you want in the case that you're applying it a string
literal. But in that case you shouldn't cast, you
On Sunday, 15 August 2021 at 09:06:14 UTC, Mike Parker wrote:
The D `string` is an alias for `immutable(char)[]`, immutable
contents of a mutable array reference (`immutable(char[])`
would mean the array reference is also immutable). You don't
want to assign that to a `char*`, because then
So when I'm doing something like the following: `string name =
"John";`
Then what's the actual type of the literal `"John"`?
In the chapter [Calling C
functions](https://dlang.org/spec/interfaceToC.html#calling_c_functions) in the "Interfacing with C" page, the following is said:
Strings are
I'm seeing in the page about "BeterC" and in the part about the
[retained
features](https://dlang.org/spec/betterc.html#retained), the #11
says about "COM classes and C++ classes". What are the "C++
classes"? I tried to create a class using "extern(C++)" but this
didn't worked. Can someone
On Saturday, 18 September 2021 at 22:16:32 UTC, Adam D Ruppe
wrote:
On Saturday, 18 September 2021 at 15:38:38 UTC, rempas wrote:
I'm seeing in the page about "BeterC" and in the part about
the [retained
features](https://dlang.org/spec/betterc.html#retained), the
#11 says about "COM classes
On Sunday, 10 October 2021 at 08:48:21 UTC, Imperatorn wrote:
For simple stuff you have .stringof
Thanks!
On Sunday, 10 October 2021 at 08:54:55 UTC, evilrat wrote:
That's probably depends on what you are trying to achieve.
If you want to write code-like string that looks like a code
you can use token strings
https://dlang.org/spec/lex.html#token_strings
```d
string code = q{
float sqr(float
Is there a way to "stringnify" in Dlang? In C we would do
something like the following:
`#define STRINGIFY(x) #x`
What's the equivalent in D?
I'm having the following C code:
```
static void* (*ppmalloc)(size_t) = malloc;
static void (*ppfree)(void*) = free;
```
I want to covert this code in D so I try to do the following:
```
static void* function(size_t)*ppmalloc = malloc;
static void function(void*)*ppfree = free;
```
If I do
This is the first time I'm finding something like that. I'm
having the following code in C:
```
if (0 == (i >> 7)) {
if (len < 1) return -1;
v = i;
return *ret = v, 1;
}
```
This is part of a function that returns an `int`. When I'm
running this in C, it works. However in D,
On Sunday, 10 October 2021 at 13:52:57 UTC, Elmar wrote:
Hopefully it will :-) .
D has some good C support. You can call any C function from `D`
by declaring it `extern(C) `.
The language subset "BetterC" is required for calling D
functions from C though. Unfortunately, the runtime
On Sunday, 10 October 2021 at 14:00:37 UTC, Elmar wrote:
On Sunday, 10 October 2021 at 13:56:06 UTC, rempas wrote:
Actually I know about BetterC and how to call C functions from
D and visa versa. I would also disagree that "BetterC" is
almost no improvement over C as about 90% of the
On Sunday, 10 October 2021 at 12:13:47 UTC, Elmar wrote:
Hello rempas.
The comma-operator `,` is like `;` but results in an expression
value, not a statement like `;` would. The left side of `,` is
executed like a statement and the value of the right side of
`,` is returned.
On Sunday, 10 October 2021 at 11:26:18 UTC, Elmar wrote:
Hello rempas.
This is the way:
```d
import core.stdc.stdlib : malloc, free;
extern(C) void* function(ulong) mallocPointer =
extern(C) void function(void*) freePointer =
```
`function` in the type is already a function pointer. Not
On Sunday, 10 October 2021 at 12:19:39 UTC, Adam D Ruppe wrote:
On Sunday, 10 October 2021 at 12:01:33 UTC, rempas wrote:
[...]
The comma expression in C is a combination of two things but in
the context of another thing. Well that's not very good, but
like there's statements and
Cause I can't find an option in the latest DMD release and
because the ImportC
[page](https://dlang.org/spec/importc.html#importing) seems to be
incomplete (even saying it's under construct), I'm wondering if
ImportC exists even as prototype but it's hidden or if it's not
available at all.
On Saturday, 16 October 2021 at 07:09:16 UTC, jfondren wrote:
This test_og.c works (while obviously breaking some bswap
functions):
I don't know if I should have known that but what is "bswap"?
It would be less annoying to compile the original test_og.o
with gcc and then link it in.
If I
On Friday, 15 October 2021 at 20:45:35 UTC, jfondren wrote:
There's no option, you just use a normal import statement when
the module is named .c instead of .d
I say 'just' but typical C uses the C preprocessor and can't be
imported as-is.
[ ... ]
First of all, I see you answering
On Saturday, 16 October 2021 at 11:03:06 UTC, jfondren wrote:
I came up with those `#define`s by looking at test_c.c as d
complained about it. It includes these functions in the final
result:
```c
static __uint16_t
__bswap_16 (__uint16_t __bsx)
{
return (__bsx);
}
static __uint32_t
I want to use an expression and put it in place inside the `if`
parentheses. The expression is: `is(typeof(val) == type)`. I want
to use a template called "is_same" that will take the value and a
type to place them to the respective places. I have tried the
following but it doesn't seem to
On Friday, 17 December 2021 at 08:44:39 UTC, Mitacha wrote:
It isn't really about limitation of templates. You're trying to
use mixin template and it's main purpose is to inject
declarations. If you want to replace `is expression` with
template you could use something like this:
```d
bool
On Monday, 20 December 2021 at 09:30:30 UTC, rumbu wrote:
because you cannot have statements directly in a template (the
fact that is a mixin template is irelevant), only declarations.
If you want to just insert some random code, use strings. You
can create a templated enum to store your
On Friday, 17 December 2021 at 16:02:45 UTC, RazvanN wrote:
There is also a compiler trait [1] which can do that for you:
```d
void main()
{
int val = 10;
static if (__traits(isSame, typeof(val), int)) {}
}
```
[1] https://dlang.org/spec/traits.html#isSame
Thanks! The other options
On Friday, 17 December 2021 at 13:00:55 UTC, Ali Çehreli wrote:
On 12/17/21 1:57 AM, bauss wrote:
> You can also do it as a normal template:
>
> ```d
> template is_same(alias value, T)
> {
> enum is_same = is(typeof(value) == T);
> }
> ```
And even shorter by realizing that it's an
Here I am having a problem with templates again. No matter how
much I read, I can't seem to understand how templates/mixins
work. So I'm having the following code (just a snippet of the
real code):
```
if (c != '%') {
if (stdout_index < STDOUT_BUF_LEN) {
On Monday, 20 December 2021 at 11:58:58 UTC, Tejas wrote:
Ehh, it still fails; should've explicitly put the length of the
array and the `extern (C)` in `main`
```d
module demo;
[ ... ]
extern(C) /+added this because you used -betterC+/ void main() {
while (true) {
On Monday, 20 December 2021 at 18:06:32 UTC, rempas wrote:
On Monday, 20 December 2021 at 11:58:58 UTC, Tejas wrote:
Ehh, it still fails; should've explicitly put the length of
the array and the `extern (C)` in `main`
```d
module demo;
[ ... ]
extern(C) /+added this because you used
On Monday, 20 December 2021 at 18:12:35 UTC, Stanislav Blinov
wrote:
https://dlang.org/spec/traits.html#identifier
Thanks!!! Finally I was able to do it! The code is the following
(well not in my final project but it's a demonstration):
```
enum add_char(string c) =
`if (stdout_index <
On Monday, 20 December 2021 at 11:30:09 UTC, rumbu wrote:
Enums (that's why the string is declarated as enum) are
evaluated at compile time, the concatenation op will not end in
your code as instruction, so you can do anything outside
betterC rules as long you do it at compile time. You are
On Monday, 27 December 2021 at 14:23:37 UTC, Adam D Ruppe wrote:
[...]
After reading the whole things, I said it and I'll say it again!
You guys must get paid for your support I also helped a guy
in another forum yesterday writing a very big reply and tbh it
felt great :P
(or of
On Monday, 27 December 2021 at 14:47:51 UTC, Kagamin wrote:
https://utf8everywhere.org/ - this is an advise from a windows
programmer, I use it too. Windows allocates a per thread buffer
and when you call, say, WriteConsoleA, it first transcodes the
string to UTF-16 in the buffer and calls
On Monday, 27 December 2021 at 14:30:55 UTC, Adam D Ruppe wrote:
Most unix things do utf-8 more often than not, but technically
you are supposed to check the locale and change the terminal
settings to do it right.
Cool! I mean, I don't plan on supporting legacy systems so I
think we're fine
On Monday, 27 December 2021 at 21:38:03 UTC, Era Scarecrow wrote:
Well to add functionality with say ANSI you entered an escape
code and then stuff like offset, color, effect, etc. UTF-8
automatically has escape codes being anything 128 or over, so
as long as the terminal understand it, it
On Monday, 20 December 2021 at 22:02:02 UTC, russhy wrote:
Here how i'd do, but i'm not sure how to keep track of the
index of the arguments, i forgot..
```D
import core.stdc.stdio: putc, stdout;
void print(T...)(string prompt, T args)
{
foreach (a; args)
{
alias A =
On Monday, 20 December 2021 at 21:49:59 UTC, Adam D Ruppe wrote:
still use
foreach(arg; args)
and skip that index variable.
I know I can use foreach ("static foreach" more specifically) but
I need to be able to get the index to choose a specific argument
because I want to do formatting
On Tuesday, 21 December 2021 at 08:11:39 UTC, Anonymouse wrote:
I'm not certain I understand, but won't `foreach (i, a; args) {
/* ... */ }` in his example do that?
As in, if you necessarily must index `args` instead of using a
foreach variable,
```d
import core.stdc.stdio : putc, stdout;
Hi! I'm trying to print some Unicode characters using UTF-8
(char), UTF-16 (wchar) and UTF-32 (dchar). I want to do this
without using any library by using the "write" system call
directly with 64-bit Linux. Only the UTF-8 solution seems to be
working as expected. The other solutions will not
On Wednesday, 5 January 2022 at 09:02:53 UTC, vit wrote:
Try this:
```d
pragma(msg, type_check!("static if", "i8", "true", "5", "4",
"10", "5"));
```
Result:
```d
static if(is_same!(num, i8)) {
mixin(base_digit!("5", "4", "10", "5"));
static if (true) {
I'm trying to use mixins and enums to "expand" code in place but
the results are not what I expected and I'm getting an weird
error. I have created the smallest possible example to reproduce
the error and it is the following:
```
enum base_digit(string ten, string sixteen, string two, string
On Wednesday, 5 January 2022 at 09:33:07 UTC, vit wrote:
2) if-else must be in same mixin:
```d
mixin(""
+ type_check!("static if", "i8", "true", "5", "4",
"10", "5")
+ type_check!("else static if", "i16", "true", "7",
"6", "18", "8")
+ type_check!("else static if",
On Wednesday, 5 January 2022 at 10:47:44 UTC, rempas wrote:
There may be a problem in the "type_check" enum but I wanted to
post this reply before I search any any case there is something
else happening and you happen to know. I will update if I found
it
Well, it is specifically the "static
On Wednesday, 5 January 2022 at 17:48:03 UTC, H. S. Teoh wrote:
Yeah, this won't fly. Whatever you pass to mixin must be one or
more
*complete* declaration or (possibly compound) statements. It's
illegal
to pass the `static if` and its else-clause to two different
mixin()
invocations (they are
On Tuesday, 21 December 2021 at 10:28:15 UTC, eugene wrote:
filed an issue, see
https://issues.dlang.org/show_bug.cgi?id=22615
Nice! Hope they see and fix it soon! Love for open source
Operating Systems!!
On Tuesday, 21 December 2021 at 15:42:59 UTC, russhy wrote:
Please keep us updated, that'll be interesting to see how a
pure D printf would look like!
Glad someone is interested! I'm actually planning to make a whole
library ;)
Check my
On Tuesday, 21 December 2021 at 08:42:35 UTC, vit wrote:
You can use switch + static foreach:
```d
import std.stdio;
//this print args in reverse order:
void print(T...)(string prompt, T args)
{
void print_arg(size_t index){
switch(index){
I would love to see more full (and correct) support for FreeBSD,
OpenBSD and DragonflyBSD from Dlang! Maybe one day..
On Tuesday, 21 December 2021 at 17:00:06 UTC, Johan wrote:
Please add which compiler(s) you have tried in the bug report.
Yeah, you are right! Please eugene use LDC2 and check confirm
that the behavior is the same there.
I think the fix is needed here:
On Tuesday, 21 December 2021 at 19:00:04 UTC, eugene wrote:
Well, I just installed it by
pkg intstall ldc
Actually, this is my first experience with FreeBSD,
I did not have much to go deeper.
That's nice trying new things ;)
Oh, no, sorry. :)
It is the problem of FreeBSD maintainers
On Tuesday, 21 December 2021 at 18:35:43 UTC, eugene wrote:
LDC2 stdlib does not have correct struct event_t for 12+ in
/usr/local/include/d/core/sys/freebsd/sys/event.d at all,
only for earlier versions, ie without extension field.
DMD stdlib does have, the only problem is the OS version is
On Tuesday, 21 December 2021 at 19:40:52 UTC, eugene wrote:
But i like to use software out of the box and
do not like compile it from source.
Me too! The link I gave you has a binary release with LDC2. You
won't have to compile it yourself.
I do not see any reason for me to do this.
The
On Tuesday, 21 December 2021 at 19:55:13 UTC, eugene wrote:
core/sys/freebsd/config.d and core/sys/freebsd/sys/event.d
are the same as in fresh dmd, so there is not much sense to try
it.
dmd (including phobos) is a reference, and I do not think,
that ldc is ahead of dmd with it's stdlib.
On Tuesday, 21 December 2021 at 17:33:09 UTC, Steven
Schveighoffer wrote:
The reason your original isn't working is that indexing a list
of differently-typed things cannot be done using a runtime
index.
I'd say that an inner function + static foreach + switch is the
best way to convert
I would like to know if that's possible. Actually I would like to
do something like the following:
```
extern (C) void main() {
void print_num(int num, comp_time_type int mul) {
static if (is(mul == ten)) {
printf("%d\n", num * 10);
} else static if (is(mul == three)) {
On Tuesday, 28 December 2021 at 13:04:26 UTC, Adam D Ruppe wrote:
What is your library? You might be able to just use my
terminal.d too
My library will be "libd" it will be like "libc" but better and
cooler! And it will be native to D! And of course it will not
depend on "libc" and it
On Tuesday, 28 December 2021 at 14:53:57 UTC, rempas wrote:
On Tuesday, 28 December 2021 at 12:56:11 UTC, Adam D Ruppe
wrote:
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
and that's not quite full either. it really is a mess from
hell
Still less complicated and organized
On Tuesday, 28 December 2021 at 12:56:11 UTC, Adam D Ruppe wrote:
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
and that's not quite full either. it really is a mess from
hell
Still less complicated and organized than my life...
Let's say that I have the following float/double: 137.837
How can I find how many places from left the dot appears? So in
this example I want to take either three or four (depending on
how you think it). Does anyone knows how I can do that and can
explain it to me?
On Tuesday, 28 December 2021 at 22:06:50 UTC, Steven
Schveighoffer wrote:
On 12/28/21 4:19 PM, rempas wrote:
Here:
```
extern (C) void main() {
void print_num(int mul)(int num) {
static if (is(mul == ten)) {
printf("%d\n", num * 10);
} else static if (is(mul == three)) {
On Tuesday, 28 December 2021 at 22:26:33 UTC, max haughton wrote:
Why do you need this? What's wrong with a normal branch in this
case.
Runtime performance. I want the value to get checked at compile
time and use "static if" with it
On Wednesday, 29 December 2021 at 01:34:22 UTC, Stanislav Blinov
wrote:
One can also do this kind of stuff:
```d
import core.stdc.stdio;
struct Literal(alias val)
{
enum value = val;
}
enum lit(alias val) = Literal!val.init;
void print_num(Arg)(int num, Arg mul)
{
static if (is(Arg
On Thursday, 30 December 2021 at 11:17:39 UTC, afg45 wrote:
See the https://en.wikipedia.org/wiki/Common_logarithm fpr the
explanations.
```
import std.stdio, std.math;
void main(string[] args)
{
alias numDigits = (f) => log10(f + 0.5).ceil();
}
```
Thanks a lot! However, I used the
On Tuesday, 21 December 2021 at 21:09:14 UTC, eugene wrote:
* The ldc installed by 'pkg install ldc' (the old one), does
not have config module
* Most resent ldc (link you indicated), does have condig
module, and it is exactly the same as condig in most recent dmd
Cool! Makes sense! I
On Tuesday, 21 December 2021 at 22:50:57 UTC, russhy wrote:
I took a look and to be honest, it's the same story as
everything in the STD, they try to do everything at the same
time, so they up end calling each other, you end up lost in
multiple 8k LOC modules, not understanding what the
On Wednesday, 22 December 2021 at 08:41:56 UTC, eugene wrote:
You thought right - I **DID NOT** try the latest LDC, I just
looked into
ldc2-1.28.0-freebsd-x86_64.tar.xz archive to see
what is in core/sys/freebsd/config.d and in
core/sys/freebsd/sys/event.d
Both these files are just copies
On Monday, 20 December 2021 at 18:58:39 UTC, bachmeier wrote:
You can see the ["String mixins" section
here](http://ddili.org/ders/d.en/mixin.html) for more details.
Mixins are generated at compile time, so if you're referring to
a string mixin inside a runtime loop, the code will not be
On Sunday, 19 December 2021 at 09:49:29 UTC, eugene wrote:
test program:
```d
import std.stdio;
import core.sys.freebsd.config;
import core.sys.freebsd.sys.event;
void main(string[] args) {
writefln("FreeBSD_version = %s", __FreeBSD_version);
writefln("sizeof(kevent_t) = %s",
I'm trying to implement "printf" and I'm getting an error. The
smallest possible code to demonstrate the error is:
```
import core.stdc.stdio;
void print(T...)(string prompt, T args) {
// Suppose all 'args' are of type "string" for this example
ulong carg = 0;
for (ulong i = 0; i <
On Wednesday, 22 December 2021 at 09:49:59 UTC, eugene wrote:
It looks strange - leading D compiler is not in Linux/FreeBSD
repos :)
Well no so much. The only official compiler is DMD and when it
comes to that, Digital Mars, has pre-built binaries for most
Linux distros and for FreeBSD.
On Monday, 27 December 2021 at 09:29:38 UTC, Kagamin wrote:
D strings are plain arrays without any text-specific logic, the
element is called code unit, which has a fixed size, and the
array length specifies how many elements are in the array. This
model is most adequate for memory
1 - 100 of 241 matches
Mail list logo