On Wednesday, 2 January 2019 at 17:49:52 UTC, H. S. Teoh wrote:
On Wed, Jan 02, 2019 at 05:38:41PM +, IM via
Digitalmars-d-learn wrote:
1- How do I do in D the equivalent of the following C++ macro?
#define OUT_VAL(val) (count << #val << " = " << val << endl)
In particular the #val above t
On Wednesday, 2 January 2019 at 21:56:03 UTC, Steven
Schveighoffer wrote:
On 1/2/19 12:38 PM, IM wrote:
[...]
With those ... I have to guess.
There are 2 possibilities.
Possibility 1: there is a method named 'doSomeWork' which takes
at least one parameter. This overrides the UFCS function
On 1/2/19 12:38 PM, IM wrote:
2- Yesterday I was experimenting with something and I wrote something
like the following:
struct MyType {
...
}
void doSomeWork(ref MyType o) {
...
}
auto t = MyType(...);
t.doSomeWork(); // <-- failed to compile.
Why did the above UFCS call fail to com
On Wed, Jan 02, 2019 at 05:38:41PM +, IM via Digitalmars-d-learn wrote:
> 1- How do I do in D the equivalent of the following C++ macro?
>
> #define OUT_VAL(val) (count << #val << " = " << val << endl)
>
> In particular the #val above to the actual macro argument as a string?
[...]
Try somet
By using the interface,
it also
forces the user to include all of the attributes of each pin
such as
direction, max load, DC current, etc. Since class type enums
are references,
they are light, - and they should be immutable - so they are
thread safe aslo.
I'm not sure how you're using your
On Thursday, 3 April 2014 at 23:16:14 UTC, Eric wrote:
Okay - I'm new to D, and I'm comming from a java background.
Suppose
you are designing an API, and you want the user to supply
arguments
as an enum. But the user needs to define the enum, so how can
the API
know in advance what enum to re
On Thursday, 3 April 2014 at 22:34:19 UTC, bearophile wrote:
Eric:
I disagree. If you just think of a class type enum as a class
type,
then what you say makes sense. But if you instead think of it
as a more powerful enum then it can enhance data safety in a
program.
I was speaking about th
Eric:
I disagree. If you just think of a class type enum as a class
type,
then what you say makes sense. But if you instead think of it
as a more powerful enum then it can enhance data safety in a
program.
I was speaking about the current D enum, as implemented and as
designed. Regarding y
In some cases you can use the handy with() statement for that
purpose.
One example usages:
final switch (foo) with (MyEnum) {
...
}
Okay - the with statement may help in some cases. I'll
have to try it out...
Using an enumeration of class instances isn't a good idea, they
are des
Eric:
1). Is there a way to "import" an enum so that you don't need
to qualify each instance with the type name? Something like
java does with its "static import".
In some cases you can use the handy with() statement for that
purpose.
One example usages:
final switch (foo) with (MyEnum)
On Wednesday, 27 November 2013 at 07:30:58 UTC, Jacob Carlborg
wrote:
On 2013-11-27 02:26, Craig Dillabaugh wrote:
2. Once I think my bindings are stable I would like to add
them to
Deimos or DUB registries. Are there any recommendations for
testing
bindings? I checked through some other bind
On 2013-11-27 02:26, Craig Dillabaugh wrote:
2. Once I think my bindings are stable I would like to add them to
Deimos or DUB registries. Are there any recommendations for testing
bindings? I checked through some other bindings on GitHub and didn't see
any unit tests or the like. Are there any
On Wednesday, 27 November 2013 at 02:36:01 UTC, Jesse Phillips
wrote:
Don't have answers. Do you still get segfault removing
SHPClose( hShp );
Yep.
Other comment:
writeln("Bounds = [" ~to!string(pad_min_bound) ~ ","
~ to!string(pad_max_bound) ~ "]");
writeln("B
Don't have answers. Do you still get segfault removing SHPClose(
hShp );
Other comment:
writeln("Bounds = [" ~to!string(pad_min_bound) ~ ","
~ to!string(pad_max_bound) ~ "]");
writeln("Bounds = [", pad_min_bound, ",", pad_max_bound, "]");
I will add it to Bugzilla then, if it's not already there.
http://d.puremagic.com/issues/show_bug.cgi?id=10192
Bye,
bearophile
On Tuesday, 28 May 2013 at 00:29:04 UTC, bearophile wrote:
std.typecons.Tuple supports "structural assignment" before the
change.
The code also works with 2.062.
I know it's not a regression. But you say:
"Named-field tuple should be a subtype of unnamed-field tuple."
You can have sub-typing,
Kenji Hara:
Thank you very much for your gentle and useful answers :-)
struct Foo {
immutable(char)[4] bar;
}
Foo x1 = { "AA" };// No error.
immutable(char)[4] a1 = "AA"; // No error.
void main() {
Foo x2 = { "AA" };// No error.
Foo x3 = Foo("AA"); // No erro
On Monday, 27 May 2013 at 18:00:38 UTC, bearophile wrote:
Do you know if it's OK to accept x3 assignment and refuse the
a2 assignment?
struct Foo {
immutable(char)[4] bar;
}
Foo x1 = { "AA" };// No error.
immutable(char)[4] a1 = "AA"; // No error.
void main() {
Foo x2 = { "
On 2011-03-04 03:16:50 +0100, Nick Sabalausky said:
I'm no floating-point expert, but I would think that the only way to
get an exact representation would be to output the raw data in hex (or
binary, or octal, etc):
writef("0x%X", cast(ulong)1.2);
That's also an option, certainly. Then I co
"Lars T. Kyllingstad" wrote in message
news:iknfsh$13ga$1...@digitalmars.com...
> On Wed, 02 Mar 2011 13:35:11 +0100, Magnus Lie Hetland wrote:
>
>> First question: I just noticed that writefln("%a", 1.2) writes
>> 0x1.3p+0, while writeln(format("%a", 1.2)) (that is, with
>> std.strin
On Wed, 02 Mar 2011 13:35:11 +0100, Magnus Lie Hetland wrote:
> First question: I just noticed that writefln("%a", 1.2) writes
> 0x1.3p+0, while writeln(format("%a", 1.2)) (that is, with
> std.string.format) writes 0x9.8p-3 ... wouldn't it be nice
> to be consistent here? (
Juanjo Alvarez Wrote:
> Hi,
>
> I'm converting a C header file but there are two things left:
>
> 1. If the header file contains some D reserved word (in my case, "in" and
> "out" in a struct) what is the best way to workaround it? Do you write
> another C file and link about it?
The conventi
Auto reply, found both:
1. Just rename the varname, stupid stupid stupid!
2. import std.c.stdarg
On Thu, 23 Sep 2010 19:44:44 +, Juanjo Alvarez wrote:
> Hi,
>
> I'm converting a C header file but there are two things left:
>
> 1. If the header file contains some D reserved word (in my cas
23 matches
Mail list logo