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
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?
2- Yesterday I was experimenting with something and I wrote
something like the following:
struc
On Wednesday, 9 September 2015 at 13:17:53 UTC, Mike Parker wrote:
Yes, I get that. But how does that work when you're linking to
a C++ library and the translation of the C++ class to D is an
interface? Or is it possible now to link D classes directly
with C classes?
Classes and templates exc
On Wednesday, 9 September 2015 at 11:49:33 UTC, Kagamin wrote:
Static functions are declared with `static` storage class. This
looks so basic, it's even not documented in language spec, lol.
Yes, I get that. But how does that work when you're linking to a
C++ library and the translation of t
Static functions are declared with `static` storage class. This
looks so basic, it's even not documented in language spec, lol.
In D classes are reference types by default.
On 2015-09-09 11:55, Mike Parker wrote:
Given a C++ class that looks like this:
class Foo {
static void Initialize(const SomeObject&);
virtual void func1();
}
The documentation at [1] doesn't say anything about how to handle static
member functions like Initialize, nor do I see anythin
Given a C++ class that looks like this:
class Foo {
static void Initialize(const SomeObject&);
virtual void func1();
}
The documentation at [1] doesn't say anything about how to handle
static member functions like Initialize, nor do I see anything
about references. I assume I can declar
On Wednesday, 9 September 2015 at 09:55:21 UTC, Mike Parker wrote:
The documentation at [1] doesn't say anything about how to
[1] http://dlang.org/cpp_interface.html
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)
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".
2). It seems that you can't use an enum of struct or class type
in a switch statement. This seems inconsistent. Would it make
sense t
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, "]");
.
0x00443fc7 in rt.dmain2._d_run_main() ()
Printing the backtrace provides no additional information. The
same problem occurs whether I used my hand-rolled binds or the
DStep version.
So my two questions are:
1. Does anyone have any idea why my program is segfaulting. It
seems to crash a
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 = { "
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 = { "AA" };// No error.
Foo x3 = Foo("AA"); //
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? (
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? (The former is what printf in gcc gives.) Or am
I missing a differen
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
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?
2. What about va_list?
35 matches
Mail list logo