Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #962 from WalterBright/c_long
Browse files Browse the repository at this point in the history
add cpp_long, cpp_ulong
  • Loading branch information
andralex committed Oct 14, 2014
2 parents 099cce4 + d17aef5 commit 393cb29
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/core/stdc/config.d
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,37 @@ nothrow:

version( Windows )
{
struct __c_long
{
pure nothrow @nogc @safe:
this(int x) { lng = x; }
int lng;
alias lng this;
}

struct __c_ulong
{
pure nothrow @nogc @safe:
this(uint x) { lng = x; }
uint lng;
alias lng this;
}

/*
* This is cpp_long instead of c_long because:
* 1. Implicit casting of an int to __c_long doesn't happen, because D doesn't
* allow constructor calls in implicit conversions.
* 2. long lng;
* cast(__c_long)lng;
* does not work because lng has to be implicitly cast to an int in the constructor,
* and since that truncates it is not done.
* Both of these break existing code, so until we find a resolution the types are named
* cpp_xxxx.
*/

alias __c_long cpp_long;
alias __c_ulong cpp_ulong;

alias int c_long;
alias uint c_ulong;
}
Expand All @@ -32,6 +63,25 @@ else
}
else
{
struct __c_long
{
pure nothrow @nogc @safe:
this(int x) { lng = x; }
int lng;
alias lng this;
}

struct __c_ulong
{
pure nothrow @nogc @safe:
this(uint x) { lng = x; }
uint lng;
alias lng this;
}

alias __c_long cpp_long;
alias __c_ulong cpp_ulong;

alias int c_long;
alias uint c_ulong;
}
Expand All @@ -49,6 +99,7 @@ version( DigitalMars )
*/
struct __c_long_double
{
pure nothrow @nogc @safe:
this(double d) { ld = d; }
double ld;
alias ld this;
Expand Down

0 comments on commit 393cb29

Please sign in to comment.