Steven Schveighoffer schvei...@yahoo.com wrote:
1. a function may have the same name and usage, but have a completely
different meaning. Human languages are funny that way. This means,
your function could accept a type as a parameter and use it in a very
wrong way. Most of the time,
__gshared struct foo {
int n;
}
foo f;
This f is not shared between threads, even though the
__gshared indicates it should be. Why is this not an error?
--
Simen
c:\temp\src\test.d
c:\temprdmd src\test
The system cannot find the path specified.
c:\temprdmd src/test
std.file.FileException: (...)\.rdmd\rdmd-src/test.d-(...): The system
cannot find the path specified.
Using rdmd 20090902, dmd 2.048 and 64 bit win7
I don't think that this syntax is supported at all.
You need to use __gshared with the instance instead:
__gshared foo f;
Hello.
Is there an alternative to typedef? I need to define three structs that
have exactly the same methods and properties, yet represent different
stuff.
Example:
---
struct Foo
{
this( int f ) {
_foo = f;
}
int asNumber() {
return _foo;
}
private
On Sat, 14 Aug 2010 20:05:04 -0500, Jonathan M Davis
jmdavisp...@gmail.com wrote:
[snip]
Are you looking to create a new type that while technically identical to
another type is not considered the same as that type by the type system?
- Jonathan M Davis
Yes, This is exactly what I want. I
On Saturday 14 August 2010 18:15:40 Yao G. wrote:
On Sat, 14 Aug 2010 20:05:04 -0500, Jonathan M Davis
jmdavisp...@gmail.com wrote:
[snip]
Are you looking to create a new type that while technically identical to
another type is not considered the same as that type by the type system?
On Sat, 14 Aug 2010 20:28:56 -0500, sybrandy sybra...@gmail.com wrote:
I can't recall if you can do this with structs, but if you use classes,
you should be able to define a Date Part class that has all of the
methods and data you want. Then, you just derive three sub-classes.
For example
On Sat, 14 Aug 2010 20:34:02 -0500, Jonathan M Davis
jmdavisp...@gmail.com wrote:
Well, if you search the D list for typedef, you should find some posts
that
suggest templated structs combined with alias which get you typedefs. It
sounds
like something like that will probably end up in
I settled this just using an enum value passed as template argument:
---
enum DatePart
{
Year,
Month,
Day,
}
struct DatePartImpl(T : DatePart )
{
// Insert implementation here...
}
alias DatePartImpl!(DatePart.Year) Year;
alias DatePartImpl!(DatePart.Month) Month;
alias
Is this a bug? Unit tests do not seem to work in libraries. I'm using dmd
1.062 for linux.
mylib.d :
module mylib;
void blah()
{
}
unittest
{
assert(false);
}
main.d :
module main;
import mylib;
void main()
{
blah();
}
The unit test does not get run when compiled as:
dmd
Is there a standard and/or acceptable way to make sure that pre-conditions,
post-conditions, or invariants _fail_ when running unit tests? That is, lets
say
I had a function like this
void func(int x)
in
{
assert(x 8);
}
body
{
//...
}
and I wanted to test to make sure that func()
12 matches
Mail list logo