Is there a way to identify the Windows version? Such as if it's
XP, Vista, 7, 8 or 10? Either some way to tweak with version
flags or something in the standard library.
On Monday, November 21, 2016 08:57:11 Bauss via Digitalmars-d-learn wrote:
> Is there a way to identify the Windows version? Such as if it's
> XP, Vista, 7, 8 or 10? Either some way to tweak with version
> flags or something in the standard library.
Phobos doesn't have anything like that, but you
Hello,
how can calling method on local struct throw "null this"?
struct is initialized by .init and have default values.
struct Foo {
Bar bar;
static struct Bar {
float x, y, z;
}
Bar getBar() {
return bar;
}
}
then
Foo foo = Foo.init;
auto b = foo.getBar(); // throw "null t
cast(ulong)&foo but is not null.
It won't work just in special cases what I cannot reproduce
easily.
On 21/11/2016 11:25 PM, Satoshi wrote:
Hello,
how can calling method on local struct throw "null this"?
struct is initialized by .init and have default values.
struct Foo {
Bar bar;
static struct Bar {
float x, y, z;
}
Bar getBar() {
return bar;
}
}
then
Foo foo = Foo.init;
On 11/21/2016 08:27 AM, Stefan Koch wrote:
Someone could still be hanging on to an old Reference of buf.
Who could "someone" be? It's a self-contained example, and buf doesn't
leave the test function.
On Monday, 21 November 2016 at 10:25:17 UTC, Satoshi wrote:
Hello,
how can calling method on local struct throw "null this"?
struct is initialized by .init and have default values.
struct Foo {
Bar bar;
static struct Bar {
float x, y, z;
}
Bar getBar() {
return bar;
}
}
the
On Saturday, 19 November 2016 at 00:47:00 UTC, ketmar wrote:
On Saturday, 19 November 2016 at 00:28:36 UTC, Stefan Koch
wrote:
Please don't post non-d.
it slipped accidentally, sorry. ;-)
for OP: `uint[2] a = [42, 69];` is the correct syntax.
"uint[$] a = [42, 69];"
haha for a moment I thou
On Monday, 21 November 2016 at 12:08:30 UTC, Patric Dexheimer
wrote:
On Saturday, 19 November 2016 at 00:47:00 UTC, ketmar wrote:
On Saturday, 19 November 2016 at 00:28:36 UTC, Stefan Koch
wrote:
Please don't post non-d.
it slipped accidentally, sorry. ;-)
for OP: `uint[2] a = [42, 69];` is t
On Monday, November 21, 2016 12:08:30 Patric Dexheimer via Digitalmars-d-
learn wrote:
> On Saturday, 19 November 2016 at 00:47:00 UTC, ketmar wrote:
> > On Saturday, 19 November 2016 at 00:28:36 UTC, Stefan Koch
> >
> > wrote:
> >> Please don't post non-d.
> >
> > it slipped accidentally, sorry. ;
On Monday, 21 November 2016 at 12:44:47 UTC, Jonathan M Davis
wrote:
On Monday, November 21, 2016 12:08:30 Patric Dexheimer via
Digitalmars-d- learn wrote:
No. D doesn't have that, though it's easy enough to do the same
thing with a helper template. However, Ketmar seems to like to
use his own
I'm not sure if it's the same as #15064 bug:
import std.array, std.range, std.algorithm;
immutable static foo = ["a", "b", "c"];
auto bar(R)(R r)
{
string s = r[1];
return s;
}
immutable static res = foo.enumerate.map!bar().array;
std/typecons.d(526): Error: reinterpreting
I'm having trouble evaluating basic code with rdmd. It's
complaining that std/cstream.d does not exist. I checked, and
surely enough, it doesn't. My question is why is it looking for
cstream.d? Is rdmd out of date, or is there a problem with my dmd
install? I am on OSX 10.12.1 (Sierra) and inst
On Monday, 21 November 2016 at 13:22:57 UTC, Paolo Invernizzi
wrote:
I'm not sure if it's the same as #15064 bug:
import std.array, std.range, std.algorithm;
immutable static foo = ["a", "b", "c"];
auto bar(R)(R r)
{
string s = r[1];
return s;
}
immutable static res = foo.
On Monday, 21 November 2016 at 12:42:34 UTC, ZombineDev wrote:
That was a proposal for D that was rejected in the last moment
by Andrei. My guess is that ketmar's modified dmd has that
feature implemented.
exactly. it is handy feature, so i used to it. and it slept into
code (i usually test m
Why don't lambdas cast to a delegate if they are of type R
function(Args)? I don't see any reason to that; a lambda should
be a delegate type by default, and a function only as a special
guarantee/optimization. It just makes them cumbersome to use with
toDelegate.
Probably there is a good reaso
On 11/21/16 11:24 AM, Q. Schroll wrote:
Why don't lambdas cast to a delegate if they are of type R
function(Args)? I don't see any reason to that; a lambda should be a
delegate type by default, and a function only as a special
guarantee/optimization. It just makes them cumbersome to use with
toDe
On Monday, 21 November 2016 at 11:22:40 UTC, ag0aep6g wrote:
Who could "someone" be? It's a self-contained example, and buf
doesn't leave the test function.
Anything in .data and .bss sections and stack. See
https://issues.dlang.org/show_bug.cgi?id=15723
As for GC compaction:
https://issues
On Monday, 21 November 2016 at 16:24:38 UTC, Q. Schroll wrote:
Why don't lambdas cast to a delegate if they are of type R
function(Args)? I don't see any reason to that; a lambda should
be a delegate type by default, and a function only as a special
guarantee/optimization. It just makes them cu
https://github.com/dlang/tools/commit/5ed4f176f41b7559c64cf525c07ccf13ca3a5160
this?
On Monday, 21 November 2016 at 16:37:32 UTC, Kagamin wrote:
Anything in .data and .bss sections and stack. See
https://issues.dlang.org/show_bug.cgi?id=15723
Ok, not an actual reference then, but a false pointer.
Before 2.0.72.0:
import std.algorithm : map, joiner;
import std.uni : toUpper;
import std.traits : EnumMembers;
import std.stdio : writeln;
import std.conv: to;
private enum Color : string {
RED = "red",
BLUE = "blue",
YELLOW = "yellow"
}
void main(string[] args) {
writeln( [ E
On Monday, November 21, 2016 17:01:56 Stefan via Digitalmars-d-learn wrote:
> Before 2.0.72.0:
>
> import std.algorithm : map, joiner;
> import std.uni : toUpper;
> import std.traits : EnumMembers;
> import std.stdio : writeln;
> import std.conv: to;
>
> private enum Color : string {
> RED = "
On Monday, 21 November 2016 at 16:44:34 UTC, Kagamin wrote:
https://github.com/dlang/tools/commit/5ed4f176f41b7559c64cf525c07ccf13ca3a5160
this?
That seems like a probable cause, but where is cstream being
referenced? I did github search for cstream and all it came up
with were references fr
On Monday, 21 November 2016 at 17:35:14 UTC, Meta wrote:
On Monday, 21 November 2016 at 16:44:34 UTC, Kagamin wrote:
https://github.com/dlang/tools/commit/5ed4f176f41b7559c64cf525c07ccf13ca3a5160
this?
That seems like a probable cause, but where is cstream being
referenced? I did github sear
On Monday, 21 November 2016 at 17:26:37 UTC, Jonathan M Davis
wrote:
On Monday, November 21, 2016 17:01:56 Stefan via
Digitalmars-d-learn wrote:
[...]
[...]
there was an overload for toUpper that took string as an
optimization but that inadvertently meant that types that
implicitly converted
On Monday, 21 November 2016 at 17:26:37 UTC, Jonathan M Davis
wrote:
[...]
Thanks Jonathan for the explanation. The cast works fine but
feels "unsafe".
I will wait for the next version.
Stefan
Can't find a function for it.
I would like to implement a "--version" switch for a command line
application.
Is there a clever way to do that without using the brain on every
build? :)
A dub-solution would be nice - but i didnt find it.
First, a reminder that we have this great resource of D idioms:
https://p0nce.github.io/d-idioms/#Rvalue-references:-Understanding-auto-ref-and-then-not-using-it
The link above has an idiom of mixing in a byRef() member function to a
struct. I think I've simplified the template by moving typeo
On Monday, 21 November 2016 at 19:33:54 UTC, mab-on wrote:
I would like to implement a "--version" switch for a command
line application.
Is there a clever way to do that without using the brain on
every build? :)
A dub-solution would be nice - but i didnt find it.
There is a package in the
On Monday, 21 November 2016 at 20:56:41 UTC, Karabuta wrote:
There is a package in the dub registry called commando
(https://code.dlang.org/packages/commando) for that.
Hm.. maybe i explained it wrong.
My problem is not to pass a argument to the application.
What i want is a clever mechanism
On 11/21/2016 11:16 AM, Kagamin wrote:
Can't find a function for it.
Here is a draft adapted from the following page
http://stackoverflow.com/questions/14872499/is-there-an-equivalent-to-muldiv-for-linux
This draft works for signed types:
T mulDiv(T)(T number, T numerator, T denominator) {
On Monday, 21 November 2016 at 21:32:16 UTC, mab-on wrote:
What i want is a clever mechanism to store the SemVer (or
Commit-ID) in the binary at compiletime - automatically.
Otherwise i have to think to update a const in the code every
time i build a new Version.
enum versionData = import
On Monday, 21 November 2016 at 12:44:47 UTC, Jonathan M Davis
wrote:
Someone could create a DIP for it though and argue for it. If
they did that convincingly enough, maybe it would become a
feature. I suspect that the response will be though that since
it's easy enough to just create a template
On Monday, 21 November 2016 at 23:46:41 UTC, Basile B. wrote:
On Monday, 21 November 2016 at 21:32:16 UTC, mab-on wrote:
What i want is a clever mechanism to store the SemVer (or
Commit-ID) in the binary at compiletime - automatically.
Otherwise i have to think to update a const in the code eve
On 11/20/2016 12:41 PM, ag0aep6g via Digitalmars-d-learn wrote:
On 11/20/2016 09:09 PM, Charles Hixson via Digitalmars-d-learn wrote:
Thinking it over a bit more, the item returned would need to be a
struct, but the struct wouldn't contain the array, it would just contain
a reference to the arra
On Monday, 21 November 2016 at 23:49:27 UTC, burjui wrote:
Though I would argue that it's better to use '_' instead of '$'
to denote deduced fixed size, it seems more obvious to me:
int[_] array = [ 1, 2, 3 ];
alas, `_` is valid identifier, so `enum _ = 42; int[_] a;` is
perfectly valid. dol
On Monday, 21 November 2016 at 12:44:47 UTC, Jonathan M Davis
wrote:
(it might have even had a PR which was rejected), and
presumably, Ketmar added it to his own compiler, because he
liked the feature.
exactly. it is the old patch from Kenji. the patch even survived
C++ -> D transition, 'cause
Dne 21.11.2016 v 13:44 Jonathan M Davis via Digitalmars-d-learn napsal(a):
... it's easy enough to just create a
template to do the same thing, it's not worth adding to the language.
That's a problem. I belive there is a lot of things which are easy to
add by some kind of magic (template or mix
On Monday, 21 November 2016 at 21:32:16 UTC, mab-on wrote:
On Monday, 21 November 2016 at 20:56:41 UTC, Karabuta wrote:
There is a package in the dub registry called commando
(https://code.dlang.org/packages/commando) for that.
Hm.. maybe i explained it wrong.
My problem is not to pass a arg
On Tuesday, 22 November 2016 at 00:41:42 UTC, Meta wrote:
You could write a little script to generate an increasing
version and save it in a file. Then with Dub you can use a
pre-build or pre-generate command to call that script, and in
your D code do `enum version = import("version.txt");`. Yo
On Sunday, 20 November 2016 at 17:47:50 UTC, MGW wrote:
core.exception.OutOfMemoryError@src\core\exception.d(693):
Memory allocation failed
Simple program and error. Why? Windows 7 (32) dmd 2.072.0
Making a 100 million bytes array by appending one byte at
On 2016-11-21 22:32, mab-on wrote:
On Monday, 21 November 2016 at 20:56:41 UTC, Karabuta wrote:
There is a package in the dub registry called commando
(https://code.dlang.org/packages/commando) for that.
Hm.. maybe i explained it wrong.
My problem is not to pass a argument to the application.
44 matches
Mail list logo