Am 16.08.2012 15:18, schrieb RommelVR:
I suggest changing 'in' to 'const ref' for a real boost;
The mentioned thread suggest it the other way around.
Also this gives me not the answer for my question.
Note, it's not a question of comparison of 2 languages (C vs. D), but
rather the comparison
I've created a simple 4x4 Matrix struct and have made some tests, with
surprising results. (although I've heard from similar results in c++)
struct mat4 {
float[4][4] m;
mat4 opMul(in mat4 _m);
}
mat4 mul(in mat4 m1, in mat4 m2);
I've tested this 2 multiplication functions (overloaded and
On 15.09.2011 13:48, Trass3r wrote:
If you are willing to write V(+1,-1,+1) instead you can just turn them
into functions.
really a good point! :)
Also by static function you probably mean private in D.
No, I meant for mixin I nead static functions, but I just realized,
it also works without
When porting c-code to D, I come consitently to the problem,
how to convert such a c-macro:
#define V(a,b,c) glVertex3d( a size, b size, c size );
#define N(a,b,c) glNormal3d( a, b, c );
N( 1.0, 0.0, 0.0); V(+,-,+); V(+,-,-); V(+,+,-); V(+,+,+);
...
Ok, I could just write it out, but that's not
Am 27.05.2011 14:06, schrieb Andrej Mitrovic:
Guys, where did you get the unix cp port from? I don't have it installed, so I can't use
"make install -fwin32.mak". I've also tried using the one that comes with
UnxTools from http://sourceforge.net/projects/unxutils/ , but that one fails with:
cp
Am 10.04.2011 18:54, schrieb David Nadlinger:
On 4/10/11 6:41 PM, Matthias Pleh wrote:
in C++ we can specify the bitwidth in the declaration.
So we can optimaze memory usage.
unsigned int x : 30;
unsigned int type : 2;
How can we do that in D?
You can't – if you need packed bit fields,
in C++ we can specify the bitwidth in the declaration.
So we can optimaze memory usage.
unsigned int x: 30;
unsigned int type : 2;
How can we do that in D?
°Matthias
Am 21.02.2011 19:00, schrieb bearophile:
Matthias Pleh:
Also, shouldn't an assert always reproted as a bug?
Added:
http://d.puremagic.com/issues/show_bug.cgi?id=5633
Bye,
bearophile
Ah, thanks!
Maybe a little stupid, but I get an assert when I try to compare a valid
pointer with an int casted pointer.
I know, I could compare the pointer itself, but shouldn't is-poerator
also work?
Also, shouldn't an assert always reproted as a bug?
struct Test {}
void main()
{
Test t,t2;
boo
As bearophile notet, unittest are always good!!
But for the start, I always liked to make some pretty-printing functions ...
... so this is my version
import std.stdio;
uint rotl_d(uint value,ubyte rotation){
return (value<>(value.sizeof*8 - rotation));
}
uint rotl_asm(uint value,ubyte rot
On 2011-01-01 09:32, Jonathan M Davis wrote:
On Friday 31 December 2010 23:37:17 Daren Scot Wilson wrote:
I'm wondering why the following compiles. I'm using LDC. Perhaps it's a
bug, or there's some subtlety about D. I have deliberately, out of a
combination of idleness and desire for mischi
Am 01.12.2010 20:59, schrieb Jonathan M Davis:
override is required if you compile with -w. If you don't use -w, the compiler
won't complain, but I'm not sure that it actually overrides the function in that
case. So, yes override should be there.
I've just tried it out. It is really overridden,
Or even more implicit version, since writeln and the likes recognize
toString:
writeln(a);
writeln(b);
[...]
Well there is a relatively new proposal which aims to replace toString
with more eficient and flexible function (and was generally accepted):
http://www.prowiki.org/wiki4d/wiki.cgi?
Thank you for your reply and yes that works :)
Now i m facing with the following problem, what is the trick for input stream ?
( something like
std::istream& operator>>(std::istream& in,A& a)
{
// A.someData<< in;
return in;
}
in C++ )
I m thinking of the situation when we want
Am 01.12.2010 16:51, schrieb vincent picaud:
Is there a canonical way to take into account a new type for I/O using the std
phobos library ?
To be clear I do not know how to translate something like this (in C++) in D :
#include
class A {};
std::ostream& operator<<(std::ostream& out,const
Am 17.11.2010 22:36, schrieb Steven Schveighoffer:
[...]
two ways, if you want to support multiple lengths of 4-element char arrays, you
could do:
void bar(char[4][])
if you want to support only a 4x4 array, you can do:
void bar(ref char[4][4])
If you want to pass by value, omit the ref, but
void foo(char[] a) {}
void bar(char[][] b) {}
int main(string[] args)
{
char[4] a;
char[4][4] b;
foo(a);// OK: implicit convertion
bar(b);// Error: cannot implicitly convert
//char[4u][4u] to char[][]
}
what is the reason for the differe
17 matches
Mail list logo