On Wednesday, 25 July 2012 at 02:05:14 UTC, Chris NS wrote:
Not sure yet what your exactly issue is, but have you tried to
reproduce it using register/lookup?
Bad post, that example was OK. The places where I was having
errors was from exceptions being lost.
Thanks.
Ok, interesting thing.
I switched my buffer from Vertex* to void* and I cast every Vertex I get
to void[] and add it to the buffer (slice → memcopy) and everything
works fine now. I can live with that (once the basic functions are
implemented it's not even a pain to use), but still, I wonder
Wes:
1. Is int[3,3] the same in memory as int[3][3]?
I can't really tell based on the description.
http://dlang.org/arrays.html
Your first syntax is more like C#, not D.
In D there are fixed-sized arrays like your second one, and it's
rectangular, it's nine adjacent integers.
A dynamic
Hi, would the response to this question :
http://stackoverflow.com/questions/757684/enum-inheritance be the same
for D?
I have these two enums:
enum first : string{
a=a,
b=b
}
enum second : string{
a=first.a,
b=first.b,
c=c
}
Is there a way to make this cleaner? I don't mind having
On 2012-07-26 13:22, Wes wrote:
2. Is there a command such as #error or #warning in D?
I assume this is maybe #pragma (msg, error message) static
assert(0);?
D doesn't really have any of these, but you can emulate them. You can use:
pragma(msg, warning: message)
To emulate a warning. This
On Thu, 26 Jul 2012 13:34:34 +0200, bearophile bearophileh...@lycos.com
wrote:
static assert(0, ...);
But in release mode it doesn't print the message.
Now that'd be something. :p
--
Simen
On 2012-07-26 13:40, maarten van damme wrote:
Hi, would the response to this question :
http://stackoverflow.com/questions/757684/enum-inheritance be the same
for D?
I have these two enums:
enum first : string{
a=a,
b=b
}
enum second : string{
a=first.a,
b=first.b,
c=c
}
Is there a
maarten van damme:
enum first : string{
a=a,
b=b
}
enum second : string{
a=first.a,
b=first.b,
c=c
}
Is there a way to make this cleaner?
By convention in D enum names start with an upper case.
I have tried this, partially derived by Simen Kjaeraas code (with
T.stringof), but isn't D
On Thu, 26 Jul 2012 15:07:56 +0200, bearophile bearophileh...@lycos.com
wrote:
but isn't D supporting mixins inside enums?
Nope. The text contents of the string must be compilable as a valid
StatementList, and is compiled as such.
And enums don't allow statements in their body.
--
I've also written this implementation of enumerations. It's a bit
different from normal D enums, but supports inheritance, guarantees unique
values, as is much more conservative in what conversions and operations it
allows.
I'm considering adding addition and subtraction of integers as
On 26-Jul-12 14:14, David wrote:
Ok, interesting thing.
I switched my buffer from Vertex* to void* and I cast every Vertex I get
to void[] and add it to the buffer (slice → memcopy) and everything
works fine now. I can live with that (once the basic functions are
implemented it's not even a
Such a shame that enums do not allow mixins to be made. This
(mixin(EnumInh!First)) would've been an imho way cleaner solution then
declaring your own kind off enum and doing template magic on that.
I still have some problems with Simen's code (the first one, haven't
yet experimented with
On Thu, 26 Jul 2012 18:08:24 +0200, maarten van damme
maartenvd1...@gmail.com wrote:
The newly generated ExtendEnum will try to convert my old enum with
string fields to integer fields. the mixin should generated
ExtendEnum : string when passing in an enum with type string. Same
problem
I was trying to write a PRNG, and I wanted to give it two seed
methods. The first is to seed from a unique UIntType, and the
other is to seed from an entire range of seeds. Like so:
void seed(UIntType value = default_seed)
{...}
void seed(Range)(Range range)
if (isInputRange!Range)
I have this code:
import std.stdio;
void main()
{
f();
g();
}
void f()
{
writeln(f());
}
void g()
{
writeln(g());
}
I compile with the command:
dmd test.d -profile
Then I execute it. It prints:
f()
g()
as expected. Shouldn't it print profiling information
Sorry, I just saw the generated file...
:p
On Thu, 26 Jul 2012 19:18:21 +0200, monarch_dodra monarchdo...@gmail.com
wrote:
So here are my two questions:
1) Is what I was originally trying to do actually illegal, or is it some
sort of compiler limitation? TDPL implies this should work perfectly
fine...
Compiler limitation. It's
On Thursday, 26 July 2012 at 17:57:31 UTC, Simen Kjaeraas wrote:
On Thu, 26 Jul 2012 19:18:21 +0200, monarch_dodra
monarchdo...@gmail.com wrote:
2) Is there a correct workaround?
Exactly what you did. Though, for brevity, you would write this:
void seed(T : UIntType)(T value = default_seed)
On 07/26/2012 11:14 AM, monarch_dodra wrote:
On Thursday, 26 July 2012 at 17:57:31 UTC, Simen Kjaeraas wrote:
On Thu, 26 Jul 2012 19:18:21 +0200, monarch_dodra
monarchdo...@gmail.com wrote:
2) Is there a correct workaround?
Exactly what you did. Though, for brevity, you would write this:
On Thu, 26 Jul 2012 20:14:10 +0200, monarch_dodra monarchdo...@gmail.com
wrote:
On Thursday, 26 July 2012 at 17:57:31 UTC, Simen Kjaeraas wrote:
On Thu, 26 Jul 2012 19:18:21 +0200, monarch_dodra
monarchdo...@gmail.com wrote:
2) Is there a correct workaround?
Exactly what you did. Though,
On Thursday, 26 July 2012 at 18:21:18 UTC, Ali Çehreli wrote:
Search for specialization in the following resources:
Oh... Specialization.
What with D's ability to conditionally implement, I had
completely forgotten about specialization. So that's how it's
done in D. Cool.
Thanks a lot.
On 2012-07-26 19:57, Simen Kjaeraas wrote:
2) Is there a correct workaround?
Exactly what you did. Though, for brevity, you would write this:
void seed(T : UIntType)(T value = default_seed)
Since a template function is actually not wanted this would be the
correct workaround:
void seed
Hm. Do you ever do pointer arithmetic on Vertex*? Is the size and
offsets are correct (like in Vertex vs float)?
No, yes. I really have no idea why this happens, I saved the contents of
my buffers and compared them with the buffers of the `float[]` version
(thanks to `git checkout`) and they
On 7/26/12, Jacob Carlborg d...@me.com wrote:
void seed () (UIntType value = default_seed)
Less typing as well.
Yep. It's funny how this works at all. I mean a template with no
template parameters is somehow still a template. :)
On Thursday, July 26, 2012 21:49:35 Andrej Mitrovic wrote:
On 7/26/12, Jacob Carlborg d...@me.com wrote:
void seed () (UIntType value = default_seed)
Less typing as well.
Yep. It's funny how this works at all. I mean a template with no
template parameters is somehow still a template.
I keep hearing that scope variables are going away. I missed the
discussion on it. Why is this happening?
When I read about this, I have these in mind:
void someFunc()
{
// foo is very likely to get stack allocated
scope foo = new SomeClass();
foo.use();
//
On Thursday, July 26, 2012 21:09:09 Chad J wrote:
I keep hearing that scope variables are going away. I missed the
discussion on it. Why is this happening?
When I read about this, I have these in mind:
void someFunc()
{
// foo is very likely to get stack allocated
scope
On 07/26/2012 09:19 PM, Jonathan M Davis wrote:
On Thursday, July 26, 2012 21:09:09 Chad J wrote:
I keep hearing that scope variables are going away. I missed the
discussion on it. Why is this happening?
When I read about this, I have these in mind:
void someFunc()
{
// foo is very
I need to write to a file that is 50 to 250GB on all three major
operating systems.
I tried to use the c function pwrite64. But it is not available
on the Mac.
I have seen where some have used the iostream in C++ but this
does not seem to work on the Mac.
Is there any way to write in D
On Friday, 27 July 2012 at 01:50:57 UTC, wmunger wrote:
I need to write to a file that is 50 to 250GB on all three
major operating systems.
I tried to use the c function pwrite64. But it is not
available on the Mac.
I have seen where some have used the iostream in C++ but this
does not
30 matches
Mail list logo