On Sunday, 26 March 2023 at 18:07:03 UTC, ryuukk_ wrote:
It should be the opposite
Slow code ugly
Fast code beautiful
What's fast today may not be fast tomorrow but the language might
still be relevant.
e.g.: It used to be faster to ...
- pre-calculate sin/cos tables, now the memory
On Monday, 26 September 2022 at 16:51:11 UTC, rikki cattermole
wrote:
Currently in D you would be forced to create a vtable struct
manually.
Or I could just use classes.
The cure shouldn't be worse than the disease.
But if we had something like signatures you could do this:
```d
struct Foo
On Sunday, 25 September 2022 at 02:10:00 UTC, Salih Dincer wrote:
On Saturday, 24 September 2022 at 13:17:19 UTC, rassoc wrote:
Recently I refactored some old code of mine, now utilizing
classes instead structs, and I got hit by an uninitialized
variable access pattern similar to the
On Saturday, 3 September 2022 at 13:35:39 UTC, frame wrote:
I'm not sure I fully understand how it works. I know that the
OS creates read only memory pages for both and if a memory
section is about to be written, the OS will issue a copy of the
pages so any write operation will be done in it's
On Monday, 29 August 2022 at 21:46:48 UTC, ryuukk_ wrote:
What `-g` does that makes this code compile and work with DMD?
This flag adds symbolic debug info. But I'm confident you knew
that already.
On Monday, 1 August 2022 at 17:07:43 UTC, wjoe wrote:
On Monday, 1 August 2022 at 13:09:01 UTC, Kagamin wrote:
Bar.toString is typed `@system`.
Even if I'd declare everything @safe: at module scope?
I wrote that on my phone and it got a bit messy...
``` D
module x;
@safe:
struct Foo()
{
On Monday, 1 August 2022 at 13:09:01 UTC, Kagamin wrote:
Bar.toString is typed `@system`.
Even if I'd declare everything @safe: at module scope?
struct Foo()
{
import std.format: FormatSpec;
const void toString(
scope void delegate(const(char)[]) @safe sink,
FormatSpec!char fmt)
{}
}
struct Bar
{
import std.format: FormatSpec;
const void toString(
scope void delegate(const(char)[]) @safe sink,
FormatSpec!char
On Friday, 8 July 2022 at 12:26:03 UTC, ag0aep6g wrote:
You're allowed to copy from `ubyte[]` to `ubyte[]`. But you're
not allowed to copy from `ubyte[]` to `int*[]`, because
reinterpreting a bunch of bytes as pointers is not safe.
The thing about `void[]` is that it can point to memory that
Corrections:
On Friday, 8 July 2022 at 12:40:52 UTC, wjoe wrote:
alias Recurse = AliasSeq!(Arg[0]*, Recurse!(Arg[0..$]);
```d
alias Recurse = AliasSeq!(Arg[0]*, Recurse!(Arg[1..$]);
```
void view_it(Args...)(void function(entity_t, Includes!(Args) )
```d
void
On Friday, 8 July 2022 at 12:20:13 UTC, ryuukk_ wrote:
I'm not sure how to phrase it so it'll try with code
I have this piece of code that i would like to improve, right
now i have to create bunch of duplicates
```D
void view_it(A, B)(void function(entity_t, A*, B*) cb)
{
Why is that ?
My understanding is that a void[] doesn't have a distinct type
but since the length is bytes and not elements this makes me
believe that under the hood they are byte arrays - or, rather,
managed chunks of memory.
How's copying memory without a distinct type different from
On Monday, 23 May 2022 at 13:53:02 UTC, Adam D Ruppe wrote:
On Monday, 23 May 2022 at 13:44:53 UTC, wjoe wrote:
[...]
You can actually make this work with `construct!(int[])` rather
than plain `construct`. This is a (really annoying) deficiency
in dmd's implementation. (that sdc solved
Hello,
Consider this example:
```d
module foo;
import std.stdio;
import std.algorithm;
import std.traits;
import std.range;
void print(R)(R r) {
static assert(isIterable!R);
r.each!writeln;
}
auto construct(R)(R r, ElementType!R delegate(ulong i) fn) {
static assert(isIterable!R &&
On Sunday, 17 April 2022 at 14:14:37 UTC, H. S. Teoh wrote:
Not entirely true. See paragraph 3 in:
https://dlang.org/spec/unittest.html
and 10.24.11.3 in:
https://dlang.org/spec/expression.html#assert_expressions
T
Thanks. Either I missed that the last time I checked or it
On Thursday, 14 April 2022 at 12:10:04 UTC, ag0aep6g wrote:
On 14.04.22 13:42, wjoe wrote:
Undefined behavior yes, but regardless the example proves it
can be done in @system code.
A few versions ago, possibly due to a bug or regression, the
compiler didn't complain in @safe code either.
Of
On Tuesday, 12 April 2022 at 23:23:59 UTC, Ali Çehreli wrote:
[...]
Looking at this from a technical perspective - everything you say
is true - and thanks for clearing up some of my confusion in that
department.
Looking at this from a natural language (English) perspective -
words prompt
On Tuesday, 12 April 2022 at 22:23:18 UTC, ag0aep6g wrote:
On Tuesday, 12 April 2022 at 19:54:13 UTC, wjoe wrote:
Especially since it's only a promise and the compiler accepts
this:
void foo (const(char)[] arr)
{
cast(char[])arr[0..3] = "baz";
}
string bar = "123";
foo(bar);
On Monday, 11 April 2022 at 22:10:07 UTC, Ali Çehreli wrote:
On 4/11/22 05:57, wjoe wrote:
> And because the data could be
> in ROM any modification is an error.
Fully agreed. However, how could I initialize such an object
then? (You may have meant a read-only memory page instead of
ROM.)
On Monday, 11 April 2022 at 03:24:11 UTC, Ali Çehreli wrote:
On 4/10/22 20:05, norm wrote:
> On Sunday, 10 April 2022 at 23:19:47 UTC, rikki cattermole
wrote:
> In my mind immutable data
> means the data will not change and neither will the result of
reading
> that data, ever.
Yes.
> I don't
On Monday, 11 April 2022 at 08:57:12 UTC, KytoDragon wrote:
[...]
Sadly this results in an identifier conflict, as the version
set in config.d does not seem to affect library.d. Is there any
way to import version specifiers from a separate file? I don't
want to pollute the users build files
On Tuesday, 1 March 2022 at 17:58:24 UTC, Paul Backus wrote:
On Tuesday, 1 March 2022 at 14:51:47 UTC, wjoe wrote:
Hello,
what's a dual context as in the deprecation message?
It means you have a struct or class member function that
accesses its calling context via a template alias
Hello,
what's a dual context as in the deprecation message?
```d
struct MockFile {
[...]
void writef(alias fmt, A...)(A args) { // Deprecation: function
'writef': function requires a dual-context, which is deprecated
import std.format: format;
write(format!fmt(args));
}
What's the reasoning behind picking exit code 1 ?
Makes it pretty much impossible to distinguish between a lack of
coverage code 1 and a process code 1.
Is there a handler where it can be overridden ?
On Wednesday, 29 September 2021 at 12:15:30 UTC, Steven
Schveighoffer wrote:
On 9/29/21 6:57 AM, JN wrote:
What makes the difference on whether a crash stacktrace gets
printed or not?
Sometimes I get a nice clean stacktrace with line numbers,
sometimes all I get is "segmentation fault error
On Wednesday, 22 September 2021 at 18:59:11 UTC, user1234 wrote:
[...]
I'd use option 2.
Thanks, I'll do just that :)
Is there a convenient way to exclude it from coverage ?
Because adjusting the -cov=xx percentage is kind of annoying and
may omit other things as well.
Do you care and if yes how do you handle it ?
On Tuesday, 21 September 2021 at 16:14:52 UTC, Chris_D wrote:
Thanks for the replies.
jfondren: Sorry, but I am talking about documentation. For me,
online web pages don't qualify; they are in the cloud, unreal,
with no substance. Does anyone really read 300 pages online,
in a web browser?
On Sunday, 15 August 2021 at 10:32:27 UTC, Rekel wrote:
Note you might need to open the screenshots externally, as they
are cut off by the forum.
This looks like your build system fails to detect file changes
and links outdated .o file(s), or library, which causes a
mismatch between your
On Thursday, 5 August 2021 at 11:54:38 UTC, Mike Parker wrote:
On Thursday, 5 August 2021 at 10:43:01 UTC, wjoe wrote:
Could you elaborate on ```version(assert)``` a bit more,
please ? Like I compiled with ```-release, -g``` and without
the 2 options but the ```assert``` branch was always
On Thursday, 5 August 2021 at 11:01:56 UTC, Adam D Ruppe wrote:
On Thursday, 5 August 2021 at 09:18:08 UTC, wjoe wrote:
If it's to be determined whether or not the code is being
compiled in debug or release mode, i.e. e.g. the dmd
```-release```
You should never use the -release flag. It
On Thursday, 5 August 2021 at 10:08:12 UTC, Mike Parker wrote:
On Thursday, 5 August 2021 at 09:18:08 UTC, wjoe wrote:
Given that we have `version(assert)` and
`version(D_NoBoundsChecks)`, it probably makes sense to also
have equivalents to test if contracts are enabled, or if bounds
checking
If it's to be determined whether or not the code is being
compiled in debug or release mode, i.e. e.g. the dmd
```-release``` or ```-g``` options, which version identifier is
supposed to be used ?
There's no ```release``` identifier and ```-debug``` switch and
```debug()``` condition are
On Friday, 23 July 2021 at 10:54:33 UTC, Adam D Ruppe wrote:
On Friday, 23 July 2021 at 10:04:55 UTC, wjoe wrote:
Is there a way for the compiler to consider doc comments in
auto generated, mixed in code?
If you use my adrdox generator (which runs on the dpldocs.info
website), it handles
On Friday, 23 July 2021 at 10:42:22 UTC, user1234 wrote:
On Friday, 23 July 2021 at 10:04:55 UTC, wjoe wrote:
Is there a way for the compiler to consider doc comments in
auto generated, mixed in code?
E.g.
```D
string fooImpl = q{
/// Bar does fancy things.
const void bar() { /*do
Is there a way for the compiler to consider doc comments in auto
generated, mixed in code?
E.g.
```D
string fooImpl = q{
/// Bar does fancy things.
const void bar() { /*do something fancy*/ }
};
/// This is Foo
struct Foo(A, B, C) {
mixin(fooImpl);
}
```
So that the documentation for
On Thursday, 15 July 2021 at 15:39:59 UTC, Tejas wrote:
On Thursday, 15 July 2021 at 13:28:19 UTC, wjoe wrote:
On Thursday, 15 July 2021 at 12:09:20 UTC, Tejas wrote:
[...]
The only way, for me, to explain the error message ```opIndex
isn't an lvalue and can't be modified.``` for
On Thursday, 15 July 2021 at 12:09:20 UTC, Tejas wrote:
[...]
Oh yes, that is what happens. I was trying to be a little
concise.
You are correct, this is what the code will look in the gory
details (I believe) :
```d
auto x = (auto e = i.opIndex(1), i.opIndexUnary("++")(1)/*this
may or may
On Wednesday, 14 July 2021 at 17:29:04 UTC, Ali Çehreli wrote:
On 7/14/21 2:44 AM, wjoe wrote:
>> x = (x ^^ y).to!(typeof(x));
>> }
>>
>> For example, run-time error if y == 7.
> I was planning on adding support for over-/underflow bits but
this is
> much better. Thanks!
If so, then there
On Thursday, 15 July 2021 at 04:07:49 UTC, Tejas wrote:
Your code
```d
auto x = i[1]++;
```
Expands to:
```d
auto x = (auto e = i[1]/*notice opIndex*/, ++i[1]/* notice
opIndexUnary*/, return e;);
```
This doesn't happen with pre increment. No compiler shenanigans.
Interesting to see it
On Thursday, 15 July 2021 at 04:01:15 UTC, Tejas wrote:
I'm so sorry all this was basically useless for you.
I can't spend more time on this, so as a last resort I leave
you this:
https://dlang.org/phobos/std_bitmanip.html
This is the official bit manipulation standard library, maybe
it
On Wednesday, 14 July 2021 at 16:13:35 UTC, Tejas wrote:
On Wednesday, 14 July 2021 at 15:08:56 UTC, wjoe wrote:
On Wednesday, 14 July 2021 at 14:50:01 UTC, Mike Parker wrote:
On Wednesday, 14 July 2021 at 12:35:07 UTC, wjoe wrote:
[...]
It's how the contract of post-inc/dec
On Wednesday, 14 July 2021 at 14:50:01 UTC, Mike Parker wrote:
On Wednesday, 14 July 2021 at 12:35:07 UTC, wjoe wrote:
[...]
It's how the contract of post-inc/dec work---pre-inc/dec return
the modified value, post-inc/dec return the original value.
[...]
That makes a lot of sense now,
On Wednesday, 14 July 2021 at 14:39:03 UTC, vit wrote:
On Wednesday, 14 July 2021 at 13:16:49 UTC, Tejas wrote:
On Wednesday, 14 July 2021 at 13:09:56 UTC, vit wrote:
On Wednesday, 14 July 2021 at 12:49:58 UTC, Tejas wrote:
[...]
From doc: https://dlang.org/spec/operatoroverloading.html
On Wednesday, 14 July 2021 at 12:49:58 UTC, Tejas wrote:
I think it's a bug, because the following works:
```d
import std.stdio;
struct abc{
int[100] a;
int opIndex(int index){
return a[index];
}
int opIndexUnary(string s)(int index)
if(s == "++"){
On Wednesday, 14 July 2021 at 11:31:36 UTC, Tejas wrote:
``` {auto a = i[1] , ++i[1] , a} //note the , not the ;```
Sorry I can't provide something even more concrete.
Yes I saw that, and I suppose it would work just fine if it were
rewritten to just ```++i[1]```.
What I'm struggling to
On Wednesday, 14 July 2021 at 00:10:59 UTC, seany wrote:
On Tuesday, 13 July 2021 at 17:49:54 UTC, Adam D Ruppe wrote:
On Tuesday, 13 July 2021 at 16:52:43 UTC, seany wrote:
[...]
true if it succeeded.
[...]
You mean transparently rerun some code? That's better done
with the lowlevel
I'm want to do something like this
```D
part_int_t!(1,2,3) i;
auto x = -i[0];
--i[1]; // 1
i[1]++; // 2
```
I think the operator I need to overload would be opIndexUnary
which I did.
(1) compiles.
(2) doesn't - the compiler complains that i.opIndex isn't an
lvalue and can't be modified.
The
On Tuesday, 13 July 2021 at 15:14:26 UTC, Ali Çehreli wrote:
On 7/13/21 4:12 AM, wjoe wrote:
> ```D
> byte x = some_val;
> long y = some_val;
>
> x ^^= y; // Error: cannot implicitly convert expression
> pow(cast(long)cast(int)x, y) of type long to byte
[...]
> I rewrote it to something like
```D
byte x = some_val;
long y = some_val;
x ^^= y; // Error: cannot implicitly convert expression
pow(cast(long)cast(int)x, y) of type long to byte
```
Is there a way to do this via ^^= ?
This is part of a unittest for opIndexOpAssign where the type of
x is that of i.opIndex(_i). It's
On Monday, 21 June 2021 at 03:59:10 UTC, someone wrote:
I often need to iterate through a filtered collection
(associative array) as following:
```d
string strComputerIDunwanted = "WS2"; /// associative array key
to exclude
foreach (strComputerID, udtComputer; udtComputers) { ///
On Friday, 4 June 2021 at 11:36:09 UTC, Adam D. Ruppe wrote:
On Friday, 4 June 2021 at 11:33:32 UTC, wjoe wrote:
This is a contrived example. In reality I would use this with
custom array, hash map and other container implementations so
I could use them in @nogc territory by just switching out
Hi,
Consider Allocators, e.g.:
```d
struct Mallocator
{
enum usesGC = false;
/// implement alloc, free, etc. @nogc
}
struct GCAllocator
{
enum usesGC = true;
/// implement alloc, free, etc. via the GC
}
```
Now I want to have the function attributes set depending on the
On Wednesday, 23 September 2020 at 19:08:47 UTC, data pulverizer
wrote:
On Wednesday, 23 September 2020 at 18:56:33 UTC, wjoe wrote:
[...]
Didn't think that the compiler didn't know but wasn't aware
that you could use that information to statically dispatch. My
mistake, I'll shut up now!
On Wednesday, 23 September 2020 at 18:49:28 UTC, data pulverizer
wrote:
On Wednesday, 23 September 2020 at 18:37:45 UTC, wjoe wrote:
[...]
A class at compile time is it's own static type, OOP
polymorphism is a runtime feature not compile time. You have to
write your own traits for specific
On Wednesday, 23 September 2020 at 18:50:28 UTC, H. S. Teoh wrote:
Try this:
interface I {}
class C : I {}
class D {}
struct S {}
pragma(msg, is(C : I)); // true
pragma(msg, is(D : I)); // false
pragma(msg, is(S : I)); // false
So
I have some similar functions:
void register(C: IFoo)()
{
_insert!C();
}
void register(C)() if (behavesLikeFoo!C)
{
_insert!C();
}
There are more overloads with parameters so I want to merge them
void register(C, ARGS...)(ARGS args) if (behavesLikeFoo!C ||
isInstanceOf!(C, IFoo))
{
On Sunday, 20 September 2020 at 00:36:30 UTC, Adam D. Ruppe wrote:
[...]
I browsed in your arsd docs a bit and I'll have a closer look at
the CGI module a bit later.
Your http2 module piqued my interest as it could come in handy
some time later :)
Looks like your modules cover everything I
On Sunday, 20 September 2020 at 00:36:30 UTC, Adam D. Ruppe wrote:
[...]
That's it - all the html and javascript are all auto-generated.
Amazing :)
Would even be more awesome if it provided a function which could
be called from a custom main on top of the FancyMain.
I find e.g. custom
On Saturday, 19 September 2020 at 20:17:06 UTC, aberba wrote:
I personally (and many others in the industry... judging by
popularity of express (node.js) and the plentiful third-party
libraries,..do prefer the router.get() design. Also having
everything abstracted in a convenient and
On Saturday, 19 September 2020 at 19:27:40 UTC, Steven
Schveighoffer wrote:
[...]
This used to be the expected way to set up vibe (using module
constructors). And vibe would provide its own main function.
I *think* the idea was to allow registration of different
handlers in their respective
On Friday, 18 September 2020 at 22:21:52 UTC, Adam D. Ruppe wrote:
On Friday, 18 September 2020 at 22:02:07 UTC, aberba wrote:
[...]
I actually added *exactly* this to cgi.d in... 2010 if I
remember right. I even kinda documented it:
On Friday, 18 September 2020 at 22:31:09 UTC, mw wrote:
On Friday, 18 September 2020 at 00:07:12 UTC, wjoe wrote:
Are there other frameworks besides vibe that can do what I
want?
Just FYI, there is also:
https://code.dlang.org/packages/hunt-framework
I never used myself, you need to
On Friday, 18 September 2020 at 22:02:07 UTC, aberba wrote:
[...]
That's what I was trying to answer. When Steve said meh, he
probably didn't get what I said. Probably its because of my
typos.
This sort of convenience and productivity benefit is part of
why I use Node.Js in the job when I
On Friday, 18 September 2020 at 14:15:27 UTC, Steven
Schveighoffer wrote:
On 9/18/20 7:38 AM, wjoe wrote:
[...]
There are other options.
for instance dub (the project) has a library and an
application. the config looks like this:
configuration "application" {
targetType
On Friday, 18 September 2020 at 14:01:55 UTC, Mike Parker wrote:
On Friday, 18 September 2020 at 12:28:30 UTC, wjoe wrote:
2 issues though.
- It doesn't build the library automatically, and
You'll have to invoke dub once for each config. Just slap both
commands in a script.
- Linking
On Friday, 18 September 2020 at 12:58:29 UTC, Steven
Schveighoffer wrote:
On 9/18/20 8:39 AM, Steven Schveighoffer wrote:
But again, solved with an enhancement that allows you to
process the data in your code. I'll file the enhancement
request for you, as I think it's a nice addition.
On Friday, 18 September 2020 at 12:39:43 UTC, Steven
Schveighoffer wrote:
On 9/17/20 8:07 PM, wjoe wrote:
[...]
See the code here:
https://github.com/vibe-d/vibe.d/blob/ebebfa827f568cc9bced4bec2b66edc043a8adf7/inet/vibe/inet/webform.d#L311
[...]
No, not at the moment. Which is why I was
On Friday, 18 September 2020 at 12:03:45 UTC, Mike Parker wrote:
On Friday, 18 September 2020 at 11:38:14 UTC, wjoe wrote:
Something like this:
configuration "lib" {
targetType "dynamicLibrary"
sourceDir "source/lib/"
}
configuration "app" {
targetType "executable"
sourceFiles
On Friday, 18 September 2020 at 11:44:39 UTC, Atwork wrote:
On Friday, 18 September 2020 at 00:07:12 UTC, wjoe wrote:
And if not, how is data processed with a 10mb file upload
followed by a few number fields ?
It needs to read all of the file data to get to the other data
fields, doesn't it ?
configuration "app" {
versions "CLI"
target "executable"
...
}
configuration "guiapp" : "app" {
versions "GUI"
sourceFiles "source/gui.d"
}
The guiapp should basically inherit the "app" configuration and
extend/override whatever else is needed/different.
Something like this:
configuration "lib" {
targetType "dynamicLibrary"
sourceDir "source/lib/"
}
configuration "app" {
targetType "executable"
sourceFiles "source/app.d"
linkWith "lib"
}
I found subConfiguration in the docs but that seems to be related
to external dependencies.
On Thursday, 17 September 2020 at 22:33:46 UTC, Steven
Schveighoffer wrote:
On 9/17/20 6:13 PM, aberba wrote:
On Thursday, 17 September 2020 at 21:57:37 UTC, Steven
Schveighoffer wrote:
On 9/17/20 1:08 PM, wjoe wrote:
[...]
the `files` property actually does the processing only when
you
On Thursday, 17 September 2020 at 19:27:41 UTC, Adam D. Ruppe
wrote:
fyi my baby was just born i'll come back to this but it might
be a day or two
congratulations! All the best for your family :)
On Thursday, 17 September 2020 at 16:32:55 UTC, WebFreak001 wrote:
On Thursday, 17 September 2020 at 16:00:33 UTC, wjoe wrote:
I found this [1] but unfortunately the post this refers to is
a dead link and the content, unfortunately, didn't tell me
anything that I didn't already find in the
I found this [1] but unfortunately the post this refers to is a
dead link and the content, unfortunately, didn't tell me anything
that I didn't already find in the docs.
What I can get from the form is the form fields with content, the
field name for the file upload and the file name. But the
On Tuesday, 15 September 2020 at 01:49:13 UTC, James Blachly
wrote:
I wish to write a function including ∂x and ∂y (these are
trivial to type with appropriate keyboard shortcuts - alt+d on
Mac), but without a unicode byte order mark at the beginning of
the file, the lexer rejects the tokens.
On Monday, 7 September 2020 at 11:44:40 UTC, Paul Backus wrote:
On Monday, 7 September 2020 at 11:25:15 UTC, wjoe wrote:
It's easy to declare the entire module @safe and functions
which can't be can be declared @system.
However there is const, immutable, pure, @nogc and nothrow but
no mutable,
It's easy to declare the entire module @safe and functions which
can't be can be declared @system.
However there is const, immutable, pure, @nogc and nothrow but no
mutable, impure, @gc and throws.
Why is that ?
On Thursday, 13 August 2020 at 07:08:21 UTC, Jon Degenhardt wrote:
Test Elapsed System User
--- --
tsv-select -f 2,3 FILE 10.280.42 9.85
cat FILE | tsv-select -f 2,311.101.45 10.23
cut -f 2,3 FILE
On Thursday, 6 August 2020 at 17:18:12 UTC, rikki cattermole
wrote:
On 07/08/2020 5:12 AM, wjoe wrote:
There's core.memory.GC.reserve which requests memory from the
OS. Basically pre-allocating memory for the GC heap.
Is the GC heap shared among all threads ?
That is up to the GC
There's core.memory.GC.reserve which requests memory from the OS.
Basically pre-allocating memory for the GC heap.
Is the GC heap shared among all threads ?
E.g what happens if I GC.reserve(4.MiB) ? Is it 4 MiB in total or
per thread ?
And is it correct that even if I call GC.disable, the GC
On Saturday, 1 August 2020 at 16:04:01 UTC, Steven Schveighoffer
wrote:
On 7/31/20 12:32 PM, wjoe wrote:
On Friday, 31 July 2020 at 04:28:57 UTC, Ali Çehreli wrote:
Another option, which is curiously said to be more performant
in memory allocation than native arrays, is
std.array.Appender.
On Friday, 31 July 2020 at 04:28:57 UTC, Ali Çehreli wrote:
Yes but the "sharing being terminated" phrase was my attempt at
explaining things, which did not catch on. :)
Real shame. I quite like it - especially if you say it out loud
with an Austrian accent :)
Another option, which is
On Thursday, 30 July 2020 at 16:33:22 UTC, Ali Çehreli wrote:
On 7/30/20 8:58 AM, wjoe wrote:
b.reserve(n);
b.length = n;
There may be something that I don't know but I think assigning
to the .length property alone should be the same as reserving
and then assigning.
I just stumbled upon code like this:
struct Foo(T)
{
T[] b;
this(int n)
{
b.reserve(n);
b.length = n;
}
}
.reserve looks redundant.
The docs are explaining .length nicely, however lack any
specifics about reserve.
Changing the length of an array may relocate
On Tuesday, 28 July 2020 at 15:01:08 UTC, Kagamin wrote:
On Monday, 27 July 2020 at 09:41:44 UTC, wjoe wrote:
But it's possible when bound with the socket option
SO_REUSEPORT (at least that's the name of the flag on linux
since 3.9).
The docs say it can't be used to hijack an address.
This
On Tuesday, 28 July 2020 at 13:00:12 UTC, Steven Schveighoffer
wrote:
On 7/28/20 5:46 AM, MoonlightSentinel wrote:
On Tuesday, 28 July 2020 at 09:28:27 UTC, wjoe wrote:
It was run on the doc page. I suppose the examples are
wrapped in a unittest block?
Indeed, see
On Tuesday, 28 July 2020 at 09:46:01 UTC, MoonlightSentinel wrote:
On Tuesday, 28 July 2020 at 09:28:27 UTC, wjoe wrote:
It was run on the doc page. I suppose the examples are wrapped
in a unittest block?
Indeed, see
On Monday, 27 July 2020 at 12:52:53 UTC, Steven Schveighoffer
wrote:
On 7/27/20 5:49 AM, wjoe wrote:
struct A
{
mixin(bitfields!(
bool, "flag1", 1,
bool, "flag2", 1,
uint, "", 6));
}
Is this inside a function? If so, put `static` on it.
What you are
From the API documentation:
Create a bitfield pack of eight bits, which fit in one ubyte.
[...]
struct A
{
mixin(bitfields!(
bool, "flag1",1,
bool, "flag2",1,
uint, "", 6));
}
A a;
writeln(a.flag1); // 0
a.flag1 = 1;
writeln(a.flag1); // 1
a.flag1 = 0;
On Thursday, 23 July 2020 at 13:29:47 UTC, Kagamin wrote:
On Wednesday, 22 July 2020 at 16:14:24 UTC, wjoe wrote:
If you send a UDP datagram to a single address, however, it
will still be delivered to every program on that PC which
receives UDP datagrams from that port.
Normally binding two
On Wednesday, 22 July 2020 at 16:14:24 UTC, wjoe wrote:
When receiving packets, the IP header contains the destination
address of your public IP (the router), which it will translate
to the local address according to the port forwarding setup.
Pardon me, I meant to say according to the
On Wednesday, 22 July 2020 at 15:26:23 UTC, Dukc wrote:
On Wednesday, 22 July 2020 at 13:17:11 UTC, wjoe wrote:
- Choosing a port which isn't in use right now isn't good
enough because a few minutes later there may be another
program using it, too, and for the same reason.
But doesn't the
On Tuesday, 21 July 2020 at 18:35:34 UTC, notna wrote:
well, I guess all your remarks are true... and irrelevant at
the same time.
please go back and read his first post starts with "I have
a project where I need to take and send UDP packets over the
Internet"...
... and continues
On Sunday, 19 July 2020 at 09:48:24 UTC, notna wrote:
Someone once wrote about a UDP library, which was used to sync
data to somewhere in APAC (Hongkong?) and by doing so the data
transfer was magnitudes faster then before (over TCP)...
In the best case scenario, and orders of magnitude
On Monday, 20 July 2020 at 22:05:35 UTC, WhatMeWorry wrote:
2) "The total size of a static array cannot exceed 16Mb" What
limits this? And with modern systems of 16GB and 32GB, isn't
16Mb excessively small? (an aside: shouldn't that be 16MB in
the reference instead of 16Mb? that is, Doesn't
On Friday, 10 July 2020 at 21:24:08 UTC, Ali Çehreli wrote:
What is important is overhead:
That's the major point I took from all this.
Thanks for your effort.
And thanks everybody else, too, I really appreciate it.
On Friday, 10 July 2020 at 14:20:15 UTC, wjoe wrote:
On Friday, 10 July 2020 at 10:47:49 UTC, psycha0s wrote:
On Friday, 10 July 2020 at 10:13:23 UTC, wjoe wrote:
A static array resides in this memory (with a fixed length, so
a length needn't be stored because bounds can be checked at
compile
On Friday, 10 July 2020 at 11:13:51 UTC, Stanislav Blinov wrote:
On Friday, 10 July 2020 at 10:13:23 UTC, wjoe wrote:
So many awesome answers, thank you very much everyone!
Less overhead,
Using/needing it to interface with something else, and
Efficiency are very good points.
However stack
1 - 100 of 179 matches
Mail list logo