Okay. I'm trying to get some C code to be properly callable from some D code,
which naturally involves some extern(C) blocks. One of the types that I have to
deal with looks something like this:
typedef struct
{
unsigned i:1;
} my_struct;
I have no idea how to do such a
Hello,
Does dmd inline when appropriate (eg single-line func)? or is there a hint
keyword? or what else?
Eg how to have this inlined:
private bool isPrecomposedHangulSylable (Code code) {
/** whether code is a precomposed Hangul syllable ;-) */
return (code = FIRST_HANGUL_SYLLABLE)
On 12/07/10 05:05, spir wrote:
Hello,
Does dmd inline when appropriate (eg single-line func)? or is there a hint
keyword? or what else?
Eg how to have this inlined:
private bool isPrecomposedHangulSylable (Code code) {
/** whether code is a precomposed Hangul syllable ;-) */
On Tuesday 07 December 2010 03:05:28 spir wrote:
Hello,
Does dmd inline when appropriate (eg single-line func)? or is there a hint
keyword? or what else? Eg how to have this inlined:
private bool isPrecomposedHangulSylable (Code code) {
/** whether code is a precomposed Hangul
Jonathan M Davis wrote:
On Tuesday 07 December 2010 03:05:28 spir wrote:
Hello,
Does dmd inline when appropriate (eg single-line func)? or is there a
hint keyword? or what else? Eg how to have this inlined:
private bool isPrecomposedHangulSylable (Code code) {
/** whether code is a
On Tue, 07 Dec 2010 13:44:18 +0100
Lutger Blijdestijn lutger.blijdest...@gmail.com wrote:
There are some other conditions that prevent inlining, it's best to check
for it. iirc also functions with loops, delegate and ref parameters cannot
be inlined for example. I'm not so sure about ref,
07.12.2010 11:58, Jonathan M Davis пишет:
Okay. I'm trying to get some C code to be properly callable from some D code,
which naturally involves some extern(C) blocks. One of the types that I have to
deal with looks something like this:
typedef struct
{
unsigned i:1;
}
06.12.2010 22:11, Adam Ruppe пишет:
Is there a thing like C's exit() for a D program? Is
simply using C's function good enough?
Also take a look at core.runtime.Runtime.terminate()
spir wrote:
On Tue, 07 Dec 2010 13:44:18 +0100
Lutger Blijdestijn lutger.blijdest...@gmail.com wrote:
There are some other conditions that prevent inlining, it's best to check
for it. iirc also functions with loops, delegate and ref parameters
cannot be inlined for example. I'm not so sure
Lutger Blijdestijn wrote:
spir wrote:
On Tue, 07 Dec 2010 13:44:18 +0100
Lutger Blijdestijn lutger.blijdest...@gmail.com wrote:
There are some other conditions that prevent inlining, it's best to
check for it. iirc also functions with loops, delegate and ref
parameters cannot be inlined
I haven't tried but maybe htod can help, try copypasting the code to a
header file and run it through htod. There's also some flags htod can
take to simplify the output, iirc. But maybe htod isn't clever enough
to do bitfields..
On 12/7/10, Stanislav Blinov bli...@loniir.ru wrote:
07.12.2010
Hello D people,
Is there a way to unpack an array into local vars, as:
auto x = [1,2,3];
a,b,c = x;
Denis
-- -- -- -- -- -- --
vit esse estrany ☣
spir.wikidot.com
On Tuesday, December 07, 2010 09:29:18 spir wrote:
Hello D people,
Is there a way to unpack an array into local vars, as:
auto x = [1,2,3];
a,b,c = x;
No. There is no way to do multiple assignments to the left of an assignment
operator. The only way that you can do multiple
Hello again,
I started to be found of defining types which basically are arrays with free
functions, instead of creating a struct or class with methods. Not only we
still have pseudo-method syntax (for arrays only), but this allows customizing
the type when needed.
But: is there a way to
spir:
Is there a way to unpack an array into local vars, as:
auto x = [1,2,3];
a,b,c = x;
Not yet, but I have asked this feature for tuples too and maybe someone has
appreciated it.
Bye,
bearophile
spir:
But: is there a way to define functions corresponding to language operations
(opEquals, opIndex, toString...) without creating a true type?
You may find some trick to do something like that, but it's not how D is
supposed to be used. In D operators belong in a struct/class/enum. alias
Stanislav Blinov:
I'm under the impression that
struct my_struct
{
mixin(bitfields!(
uint, i, 1,
uint, , 31));
}
should do the trick.
But bitfields in C may not use the same alignments used by bitfields!() on DMD
so I think you have to test the sanity of the whole thing for each
On Tuesday, December 07, 2010 10:10:31 spir wrote:
Hello again,
I started to be found of defining types which basically are arrays with
free functions, instead of creating a struct or class with methods. Not
only we still have pseudo-method syntax (for arrays only), but this allows
On Tue, 07 Dec 2010 16:20:45 +0100
Lutger Blijdestijn lutger.blijdest...@gmail.com wrote:
Lutger Blijdestijn wrote:
spir wrote:
On Tue, 07 Dec 2010 13:44:18 +0100
Lutger Blijdestijn lutger.blijdest...@gmail.com wrote:
There are some other conditions that prevent inlining, it's
bearophile wrote:
Stanislav Blinov:
I'm under the impression that
struct my_struct
{
mixin(bitfields!(
uint, i, 1,
uint, , 31));
}
should do the trick.
But bitfields in C may not use the same alignments used by bitfields!() on DMD
so I think you have to test the sanity of the whole thing
Stanislav Blinov wrote:
But bitfields in C may not use the same alignments used by
bitfields!() on DMD so I think you have to test the sanity of the
whole thing for each combination of D compiler, operating system and C
compiler.
hm... what alignments are you talking about? bitfields
Jonathan M Davis Wrote:
Okay. I'm trying to get some C code to be properly callable from some D code,
which naturally involves some extern(C) blocks. One of the types that I have
to
deal with looks something like this:
typedef struct
{
unsigned i:1;
} my_struct;
On 12/8/10, Walter Bright newshou...@digitalmars.com wrote:
Andrej Mitrovic wrote:
I haven't tried but maybe htod can help, try copypasting the code to a
header file and run it through htod. There's also some flags htod can
take to simplify the output, iirc. But maybe htod isn't clever enough
On 12/8/10, Andrej Mitrovic andrej.mitrov...@gmail.com wrote:
On 12/8/10, Walter Bright newshou...@digitalmars.com wrote:
Andrej Mitrovic wrote:
I haven't tried but maybe htod can help, try copypasting the code to a
header file and run it through htod. There's also some flags htod can
take to
Andrej Mitrovic andrej.mitrov...@gmail.com wrote:
Cool! But, when is ctod.exe coming out? :p
That should have been cpptod. ;)
As soon as you write it.
--
Simen
On 07/12/2010 17:29, spir wrote:
Hello D people,
Is there a way to unpack an array into local vars, as:
auto x = [1,2,3];
a,b,c = x;
import std.stdio;
void unpack(A, T...)(out T vars, A data) {
assert (vars.length == data.length);
foreach (i, v; vars) {
26 matches
Mail list logo