On Saturday, 11 December 2021 at 22:28:16 UTC, forkit wrote:
On Saturday, 11 December 2021 at 21:42:49 UTC, ManKey wrote:
umm... the site has search function you know ;-)
Dude, you see, it doesn't say anything about it. It says a little
about the extension, but there is no direct answer.
This
Running 64-bit Linux
```
dmd --version
DMD64 D Compiler v2.098.0-beta.2
dub --version
DUB version 1.27.0-beta.2, built on Sep 7 2021
```
the following code 'compiles' in one project.
```d
unittest
{
gasdindgaslkdgansklnasgdlknaglkgansklsdg;
}
void main(){} // compiles, links, and 'runs unit
On Sunday, 12 December 2021 at 00:02:25 UTC, Stanislav Blinov
wrote:
@apz28, I can't figure out the intent here. To convert result
of abs to an unsigned?
The function logic works only for unsigned type and the parameter
value can be altered in body hence Unqual. If not Unqual, must
declare a
On Saturday, 27 November 2021 at 12:16:39 UTC, Ferhat Kurtulmuş
wrote:
On Saturday, 27 November 2021 at 11:35:21 UTC, Salih Dincer
wrote:
I also found similar errors but couldn't solve them. I think
it has to do with mir.slice.kind. Exactly Kind Topology...
I won't use parallel for it as a
On Saturday, 11 December 2021 at 23:44:59 UTC, Adam Ruppe wrote:
On Saturday, 11 December 2021 at 23:17:17 UTC, Stanislav Blinov
wrote:
? No. If it was unsatisfied constraint, the error would've
shown that.
And if you try to instantiate it, you'll see it is an
unsatisfied constraint anyway.
On Saturday, 11 December 2021 at 23:17:17 UTC, Stanislav Blinov
wrote:
? No. If it was unsatisfied constraint, the error would've
shown that.
And if you try to instantiate it, you'll see it is an unsatisfied
constraint anyway. There's two layers of failure here.
Using Unqual there is pretty
On Saturday, 11 December 2021 at 22:59:52 UTC, Adam Ruppe wrote:
On Saturday, 11 December 2021 at 22:50:45 UTC, apz28 wrote:
void foo2(T)(Unqual!T x) if(isUnsigned!T) {}
This means it treats foo2 as if it doesn't exist unless T is
unsigned...
onlineapp.d(15): Error: template
On Saturday, 11 December 2021 at 22:50:45 UTC, apz28 wrote:
void foo2(T)(Unqual!T x) if(isUnsigned!T) {}
This means it treats foo2 as if it doesn't exist unless T is
unsigned...
onlineapp.d(15): Error: template `onlineapp.foo2` cannot deduce
function from argument types `!()(int)`
void foo1(ubyte x) {}
void foo1(ushort x) {}
void foo1(uint x) {}
void foo1(ulong x) {}
import std.traits : isUnsigned, Unqual;
void foo2(T)(Unqual!T x) if(isUnsigned!T) {}
void main()
{
import std.math;
int s = 1;
foo1(abs(s));
foo2(abs(s)); //failed?
On Saturday, 11 December 2021 at 21:42:49 UTC, ManKey wrote:
What implementations of the C standard library does importC
support?
umm... the site has search function you know ;-)
https://dlang.org/spec/importc.html
What implementations of the C standard library does importC
support?
On Saturday, 11 December 2021 at 20:22:13 UTC, frame wrote:
```d
// iteration works, but scope behind does nothing
for({int i=0; j=0;} i<10; ++i, {++i; ++j;} ){}
// endless loop
for({int i=0; j=0;} i<10; {++i; ++j;} ){}
```
Not sure if bug or feature but it is inconsistent for me and
thus a
On Saturday, 11 December 2021 at 15:15:06 UTC, Matheus wrote:
I'm just a bit intrigued by your last sentence. Is there
anything evil this may result or anything that I should be
aware of?
Besides it looks like an error, you may think that it just
introduces a scope which can be referenced
On Saturday, 11 December 2021 at 18:51:12 UTC, Rumbu wrote:
On Saturday, 11 December 2021 at 14:42:53 UTC, russhy wrote:
Here is mine
- 0 allocations
- configurable
- let's you use it how you wish
- fast
You know that this is already in phobos?
```
"abc;def;ghi".splitter(';').joiner
On Saturday, 11 December 2021 at 14:42:53 UTC, russhy wrote:
Here is mine
- 0 allocations
- configurable
- let's you use it how you wish
- fast
You know that this is already in phobos?
```
"abc;def;ghi".splitter(';').joiner
```
On Saturday, 11 December 2021 at 01:02:36 UTC, frame wrote:
...
You probably want this:
```d
int j;
for({int i=0; j=0;} i<10; ++i){}
```
Beware, this syntax comes directly from hell
Well this works! :)
I'm just a bit intrigued by your last sentence. Is there anything
evil this may result
On Friday, 10 December 2021 at 21:55:17 UTC, Siarhei Siamashka
wrote:
...
2. reuse the existing "j" variable.
Yes.
But only one of them is a correct description of what actually
happens when the compiler processes this code. So it's a good
thing that the compiler is smart enough to
Here is mine
- 0 allocations
- configurable
- let's you use it how you wish
- fast
```D
import std;
void main()
{
string a = "abc;def;ab";
writeln("a => ", a);
foreach(item; split(a, ';'))
writeln("\t", item);
string b = "abc;def ;ab";
writeln("a => ",
On Saturday, 11 December 2021 at 09:40:47 UTC, Stanislav Blinov
wrote:
On Saturday, 11 December 2021 at 09:34:17 UTC, Ola Fosheim
Grøstad wrote:
void donttrythisathome(string s, char stripchar) @trusted {
import core.stdc.stdlib;
char* begin = cast(char*)alloca(s.length);
A
On Saturday, 11 December 2021 at 09:34:17 UTC, Ola Fosheim
Grøstad wrote:
void donttrythisathome(string s, char stripchar) @trusted {
import core.stdc.stdlib;
char* begin = cast(char*)alloca(s.length);
A function with that name, and calling alloca to boot, cannot be
@trusted ;)
On Saturday, 11 December 2021 at 09:34:17 UTC, Ola Fosheim
Grøstad wrote:
@system
Shouldn't be there. Residual leftovers… (I don't want to confuse
newbies!)
On Saturday, 11 December 2021 at 08:46:32 UTC, forkit wrote:
On Saturday, 11 December 2021 at 08:05:01 UTC, Ola Fosheim
Grøstad wrote:
Using libraries can trigger hidden allocations.
ok. fine. no unnecessary, hidden allocations then.
// --
module test;
import
On Saturday, 11 December 2021 at 09:26:06 UTC, Stanislav Blinov
wrote:
What you're showing is... indeed, don't do this, but I fail to
see what that has to do with my suggestion, or the original
code.
You worry too much, just have fun with differing ways of
expressing the same thing.
On Friday, 10 December 2021 at 23:53:47 UTC, Ola Fosheim Grøstad
wrote:
```d
char[] dontdothis(string s, int i=0, int skip=0){
if (s.length == i) return new char[](i - skip);
if (s[i] == ';') return dontdothis(s, i+1, skip+1);
auto r = dontdothis(s, i+1, skip);
r[i-skip] =
On Saturday, 11 December 2021 at 08:46:32 UTC, forkit wrote:
On Saturday, 11 December 2021 at 08:05:01 UTC, Ola Fosheim
Grøstad wrote:
Using libraries can trigger hidden allocations.
ok. fine. no unnecessary, hidden allocations then.
// --
module test;
import
On Saturday, 11 December 2021 at 08:05:01 UTC, Ola Fosheim
Grøstad wrote:
Using libraries can trigger hidden allocations.
ok. fine. no unnecessary, hidden allocations then.
// --
module test;
import core.stdc.stdio : putchar;
nothrow @nogc void main()
{
string str =
On Friday, 10 December 2021 at 18:47:53 UTC, Stanislav Blinov
wrote:
Threshold could be relative for short strings and absolute for
long ones. Makes little sense reallocating if you only waste a
couple bytes, but makes perfect sense if you've just removed
pages and pages of semicolons ;)
On Saturday, 11 December 2021 at 00:39:15 UTC, forkit wrote:
On Friday, 10 December 2021 at 22:35:58 UTC, Arjan wrote:
"abc;def;ghi".tr(";", "", "d" );
I don't think we have enough ways of doing the same thing yet...
so here's one more..
"abc;def;ghi".substitute(";", "");
Using
28 matches
Mail list logo