On 29/10/12 12:03, Jonathan M Davis wrote:
On Monday, October 29, 2012 11:42:59 Zhenya wrote:
Hi!
Tell me please,in this code first and second static if,are these
equivalent?
with arg = 1, __traits(compiles,"check(arg);") = true,
is(typeof(check(arg))) = false.
In principle, is(typeof(code))
Came across this:
#ifdef __GNUC__
#define PACKED __attribute__((packed))
#else
#define PACKED
#endif
typedef enum {
// Lots o' stuff
} PACKED my_enum_t;
typedef struct {
// Lots o' stuff
const void *ptr;
} PACKED my_struct_t;
T
On Mon, 29 Oct 2012 19:50:57 +0100
"bearophile" wrote:
> denizzzka:
>
> > I am trying to send to remote host utf8 text with zero byte at
> > end (required by protocol)
>
> What if your UTF8 string coming from D already contains several
> zeros?
>
If you need to send a string with an embedde
On 30-10-2012 10:41, Nick Sabalausky wrote:
Came across this:
#ifdef __GNUC__
#define PACKED __attribute__((packed))
#else
#define PACKED
#endif
typedef enum {
// Lots o' stuff
} PACKED my_enum_t;
typedef struct {
// Lots o' stu
Ok, a C function pointer like this:
struct MyStruct{
int (*foo)(int);
};
Translates to D as this:
struct MyStruct{
int function(int) foo;
}
But what about calling conventions? There isn't any "int extern(C)
function(int)" is there? Not sure if that would even mak
On 30-10-2012 11:13, Nick Sabalausky wrote:
Ok, a C function pointer like this:
struct MyStruct{
int (*foo)(int);
};
Translates to D as this:
struct MyStruct{
int function(int) foo;
}
But what about calling conventions? There isn't any "int extern(C)
func
On Tue, 30 Oct 2012 11:05:28 +0100
Alex Rønne Petersen wrote:
> On 30-10-2012 10:41, Nick Sabalausky wrote:
> > Came across this:
> >
> > #ifdef __GNUC__
> > #define PACKED __attribute__((packed))
> > #else
> > #define PACKED
> > #endif
> >
> > typedef enum {
On Tue, 30 Oct 2012 11:15:55 +0100
Alex Rønne Petersen wrote:
> On 30-10-2012 11:13, Nick Sabalausky wrote:
> > Ok, a C function pointer like this:
> >
> > struct MyStruct{
> > int (*foo)(int);
> > };
> >
> > Translates to D as this:
> >
> > struct MyStruct{
> > i
On 29/10/12 07:19, Ali Çehreli wrote:
On 10/28/2012 02:37 AM, Tobias Pankrath wrote:
> the struct
> SwA from above does neither correspond to SA nor to SB, it's imo more
> like SC:
>
> struct SC {
> immutable(int)* i;
> }
Just to confirm, the above indeed works:
struct SC {
immutabl
Nick Sabalausky:
Which, if any, of foo1/foo2/foo3 are extern(C)? (I know bar
definitely is.)
A general comment: if you are not sure of the answer, then the
programmer that will read your code will probably have similar
problems. So in such cases it's better to try to not write that
code.
denizzzka:
I am concerned about the extra allocations of temp arrays. here
is it, or not? compiler optimizes it?
There is one allocation, and usually the D compilers can't
optimize it away.
In my case it does not matter but for the future I would like
to know how it can be implemented wit
Hi!
Explain me please,why this code doesn't work
import dfl.all;
void main()
{
auto form = new Form;
auto button = new Button;
button.backColor = Color(0,0,0);
button.foreColor = Color(0,0,0);
form.controls.add(button);
Application.run(form);
}
I
Please help me with any flaws in logic or understanding:
For any struct S, '==' means either bitwise comparison or a call
to opEquals of S if it exists.
If S has no (dynamic arrays, associative arrays, pointers, or
class references as members (recursively)) then bitwise compare
is equivalent t
On Tuesday, 30 October 2012 at 13:34:21 UTC, Zhenya wrote:
Hi!
Explain me please,why this code doesn't work
import dfl.all;
void main()
{
auto form = new Form;
auto button = new Button;
button.backColor = Color(0,0,0);
button.foreColor = Color(0,0,0);
fo
On Tuesday, 30 October 2012 at 15:26:22 UTC, Dan wrote:
Please help me with any flaws in logic or understanding:
For any struct S, '==' means either bitwise comparison or a
call to opEquals of S if it exists.
If S has no (dynamic arrays, associative arrays, pointers, or
class references as mem
On Monday, 29 October 2012 at 15:22:39 UTC, Adam D. Ruppe wrote:
UTF-8 isn't affected by endianness.
If this is true why does the BOM have marks for big and little
endian?
http://en.wikipedia.org/wiki/Byte_order_mark#Representations_of_byte_order_marks_by_encoding
On Tuesday, 30 October 2012 at 17:12:41 UTC, Jesse Phillips wrote:
On Monday, 29 October 2012 at 15:22:39 UTC, Adam D. Ruppe wrote:
UTF-8 isn't affected by endianness.
If this is true why does the BOM have marks for big and little
endian?
http://en.wikipedia.org/wiki/Byte_order_mark#Represe
On 10/30/12, Nick Sabalausky wrote:
> Which, if any, of foo1/foo2/foo3 are extern(C)? (I know bar definitely
> is.)
All of them.
void main()
{
pragma(msg, MyFn);
pragma(msg, typeof(MyStruct.foo2));
pragma(msg, typeof(bar));
}
extern (C) int function(int)
extern (C) int function(int)
On Oct 25, 2012, at 11:18 PM, Jacob Carlborg wrote:
> On 2012-10-26 01:18, Sean Kelly wrote:
>> On Oct 25, 2012, at 4:12 PM, Alex Rønne Petersen wrote:
>>>
>>> What's used on OS X? I forget...
>>
>> The method used is similar to how GC works on Windows--there's a kernel call
>> that can be us
10/30/2012 5:17 PM, Tobias Pankrath пишет:
On Tuesday, 30 October 2012 at 17:12:41 UTC, Jesse Phillips wrote:
On Monday, 29 October 2012 at 15:22:39 UTC, Adam D. Ruppe wrote:
UTF-8 isn't affected by endianness.
If this is true why does the BOM have marks for big and little endian?
http://en.
On 30-10-2012 19:04, Sean Kelly wrote:
On Oct 25, 2012, at 11:18 PM, Jacob Carlborg wrote:
On 2012-10-26 01:18, Sean Kelly wrote:
On Oct 25, 2012, at 4:12 PM, Alex Rønne Petersen wrote:
What's used on OS X? I forget...
The method used is similar to how GC works on Windows--there's a kern
On Tuesday, 30 October 2012 at 16:44:02 UTC, Ali Çehreli wrote:
There is the following discussion currently on the main D forum:
http://forum.dlang.org/thread/iphhuttpkogmfwpuv...@forum.dlang.org
That behavior will be changed:
http://forum.dlang.org/thread/iphhuttpkogmfwpuv...@forum.dlang.
On Monday, 29 October 2012 at 23:02:46 UTC, Ali Çehreli wrote:
I wonder whether this bug is related to your case:
http://d.puremagic.com/issues/show_bug.cgi?id=5570
After all, you do pass a struct that includes non-integral
types. That bug may be it.
Ali
Thanks for following up and all
On 2012-10-30 18:44, Andrej Mitrovic wrote:
All of them.
void main()
{
pragma(msg, MyFn);
pragma(msg, typeof(MyStruct.foo2));
pragma(msg, typeof(bar));
}
extern (C) int function(int)
extern (C) int function(int)
extern (C) void(extern (C) int function(int) foo3)
extern (C) int f
On Tuesday, 30 October 2012 at 17:17:36 UTC, Tobias Pankrath
wrote:
On Tuesday, 30 October 2012 at 17:12:41 UTC, Jesse Phillips
wrote:
On Monday, 29 October 2012 at 15:22:39 UTC, Adam D. Ruppe
wrote:
UTF-8 isn't affected by endianness.
If this is true why does the BOM have marks for big and l
On Tuesday, 30 October 2012 at 20:16:12 UTC, Tobias Pankrath
wrote:
In the meantime you can use this function template to compare
structs field by field.
bool oneStepEqual(T,F)(ref T lhs, ref F rhs)
if(is(Unqual!T == Unqual!F) && is(T == struct))
{
bool result = true;
foreach
On Tuesday, 30 October 2012 at 19:16:18 UTC, Dan wrote:
So until this bug is fixed any time I have any dynamic array,
including string in struct S, implement opEquals. When the bug
is fixed I can remove them. What I didn't realize is that
including an opEquals in A will cause generation of opEq
On 10/30/2012 02:53 AM, Jonathan M Davis wrote:
On Tuesday, October 30, 2012 02:22:42 Timon Gehr wrote:
On 10/30/2012 01:43 AM, Jonathan M Davis wrote:
On Tuesday, October 30, 2012 00:29:22 Timon Gehr wrote:
On 10/30/2012 12:17 AM, Jonathan M Davis wrote:
On Monday, October 29, 2012 23:38:34
On Tuesday, 30 October 2012 at 20:17:06 UTC, Tobias Pankrath
wrote:
Beautiful version: http://dpaste.dzfl.pl/2340d73f
Beautiful indeed. Does the same approach work for generating
correct versions of opCmp, assuming arbitrary order by field
comparison as ordered in struct?
Also hashing?
Tha
On 10/30/12 4:17 PM, Tobias Pankrath wrote:
On Tuesday, 30 October 2012 at 20:16:12 UTC, Tobias Pankrath
wrote:
In the meantime you can use this function template to compare structs
field by field.
bool oneStepEqual(T,F)(ref T lhs, ref F rhs)
if(is(Unqual!T == Unqual!F) && is(T == struct))
{
Beautiful version: http://dpaste.dzfl.pl/2340d73f
Y u no short circuit?
Andrei
Left as an exercise to the reader.
On Tuesday, 30 October 2012 at 21:02:22 UTC, Dan wrote:
On Tuesday, 30 October 2012 at 20:17:06 UTC, Tobias Pankrath
wrote:
Beautiful version: http://dpaste.dzfl.pl/2340d73f
Beautiful indeed. Does the same approach work for generating
correct versions of opCmp, assuming arbitrary order by fi
On 10/30/2012 09:16 PM, Tobias Pankrath wrote:
On Tuesday, 30 October 2012 at 19:16:18 UTC, Dan wrote:
So until this bug is fixed any time I have any dynamic array,
including string in struct S, implement opEquals. When the bug is
fixed I can remove them. What I didn't realize is that including
On Oct 30, 2012, at 11:06 AM, Alex Rønne Petersen wrote:
> On 30-10-2012 19:04, Sean Kelly wrote:
>>
>>
>> The semaphore implementation for OSX is not signal-safe. Originally,
>> druntime used the signal approach on OSX and had deadlock issues in the
>> signal handler (OSX semaphores wrap a
On Monday, 22 October 2012 at 11:06:50 UTC, Jacob Carlborg wrote:
On 2012-10-22 10:48, bearophile wrote:
This page says:
http://dlang.org/class.html
The D compiler is free to rearrange the order of fields in a
class to
optimally pack them in an implementation-defined manner.
Consider the
fie
35 matches
Mail list logo