On 10/04/2024 2:50 PM, Liam McGillivray wrote:
On Tuesday, 9 April 2024 at 23:50:36 UTC, Richard (Rikki) Andrew
Cattermole wrote:
The string mixin triggers CTFE, if ``EnumPrefixes`` wasn't templated,
that would cause codegen and hence error. If you called it in a
context that wasn't CTFE only,
Place your attributes on the right hand side of the function, not the
left side.
Use the left side for attributes/type qualifiers that go on the return type.
```d
bool[7] stagesToProcess = false;
bool shouldDoInStages(int index) @nogc nothrow @safe
{
return stagesToProcess[index];
}
bool
On Wednesday, 10 April 2024 at 11:34:06 UTC, Richard (Rikki)
Andrew Cattermole wrote:
Place your attributes on the right hand side of the function,
not the left side.
Use the left side for attributes/type qualifiers that go on the
return type.
Just a word of warning, this explanation suggest
On Tuesday, 9 April 2024 at 23:50:36 UTC, Richard (Rikki) Andrew
Cattermole wrote:
On 10/04/2024 11:21 AM, Liam McGillivray wrote:
On Sunday, 7 April 2024 at 08:59:55 UTC, Richard (Rikki)
Andrew Cattermole wrote:
Unfortunately runtime and CTFE are the same target in the
compiler.
So that func
import bindbc.sdl;
import bindbc.loader;
SDL_version ver;
SDL_GetVersion(&ver);
writeln("version = ", ver); // runs and displays: version =
SDL_version(2, 30, 2)
writeln("version = ", SDL_GetVersion(&ver)); // compile fails
with
// template `wr
```c
void SDL_GetVersion(SDL_version * ver);
```
It doesn't return anything.
Its return type is void.
See the argument list where it lists the types of the arguments:
``template writeln is not callable using argument types !()(string, void)``
Which aligns with the arguments you passed to ``wr
On Wednesday, 10 April 2024 at 20:41:56 UTC, Lettever wrote:
```
import std;
Nullable!int func() => 3;
void main() {
Nullable!int a = 3;
//works fine
Nullable!int b = func();
//does not compile
}
Why make func() Nullable? It just wants to give you an int,
right? Making it a
On Wednesday, 10 April 2024 at 21:38:22 UTC, Andy Valencia wrote:
On Wednesday, 10 April 2024 at 20:41:56 UTC, Lettever wrote:
```
import std;
Nullable!int func() => 3;
void main() {
Nullable!int a = 3;
//works fine
Nullable!int b = func();
//does not compile
}
Why make func()
I wrote a "count newlines" based on mapped files. It used about
twice the CPU of the version which just read 1 meg at a time. I
thought something was amiss (needless slice indirection or
something), so I wrote the code in C. It had the same CPU usage
as the D version. So...mapped files, not
On Wednesday, April 10, 2024 2:41:56 PM MDT Lettever via Digitalmars-d-learn
wrote:
> ```
> import std;
>
> Nullable!int func() => 3;
> void main() {
> Nullable!int a = 3;
> //works fine
> Nullable!int b = func();
> //does not compile
> }
Technically, no implicit conversion is
Interesting. Thank you to both of you.
On Wednesday, 10 April 2024 at 17:38:21 UTC, Steven Schveighoffer
wrote:
On Wednesday, 10 April 2024 at 11:34:06 UTC, Richard (Rikki)
Andrew Cattermole wrote:
Place your attributes on the right hand side of the function,
not the left side.
Use the left
11 matches
Mail list logo