Re: OPTLINK Error 45 "Too Much DEBUG Data for Old CodeView format"

2015-03-21 Thread Trass3r via Digitalmars-d-learn
Just save yourself lots of headaches and abandon the optlink/omf 
crap with -m64 resp. -m32mscoff.


Re: dsource and WinAPI

2014-10-14 Thread Trass3r via Digitalmars-d-learn
the long-term solution is to include the [win32] headers in 
druntime

™


Re: How do I write __simd(void16*, void16) ?

2014-10-09 Thread Trass3r via Digitalmars-d-learn

On Wednesday, 8 October 2014 at 18:56:31 UTC, Etienne wrote:
I can't seem to find this function anywhere: __simd(void16*, 
void16)



MOVDQU => void _mm_storeu_si128 ( __m128i *p, __m128i a)
MOVDQU => __m128i _mm_loadu_si128 ( __m128i *p)


Is there a module by now that allows to directly write Intel 
intrinsics?


Re: Installing LDC on Windows

2014-09-06 Thread Trass3r via Digitalmars-d-learn
On Saturday, 6 September 2014 at 21:54:00 UTC, David Nadlinger 
wrote:

On Saturday, 6 September 2014 at 17:51:16 UTC, Trass3r wrote:

SEH was patented, so llvm doesn't support it.


That has changed.


Has it? SEH on Win64 is something entirely different from the 
original (x86) SEH design, and not covered by said patent.


Ok 2in1.
1) As far as I know the x86 SEH patent expired in June.
2) For x64 the implementation is very close now:
   
https://github.com/ldc-developers/ldc/issues/166#issuecomment-54522891


Re: Installing LDC on Windows

2014-09-06 Thread Trass3r via Digitalmars-d-learn

SEH was patented, so llvm doesn't support it.


That has changed.


Re: Showing a user specified error message when no overloads match

2014-07-26 Thread Trass3r via Digitalmars-d-learn

Yeah that's the price we pay for the simplicity.
Also most constraints directly or indirectly consist of a complex 
boolean expressions and you don't get any hint which part failed 
and why.


Re: Question about @nogc in D 2.066

2014-07-11 Thread Trass3r via Digitalmars-d-learn

http://forum.dlang.org/thread/pxotrowaqcenrpnnw...@forum.dlang.org


Re: Why is the Win32 boilerplate the way it is?

2014-06-29 Thread Trass3r via Digitalmars-d-learn
The only question I have is what happens when you use 
SUBSYSTEM:WINDOWS:4.0 (Which I understand means XP or higher) 
and the program runs on something older?




Re: what is going on with cgcs.c:351?

2014-06-17 Thread Trass3r via Digitalmars-d-learn
I think it should be possible to run DustMite on some big project 
like phobos to actually search for such internal errors.


Re: Debugging compiler crashes?

2012-07-02 Thread Trass3r

... the order of files matters? Yuck.


Yep it's a bug.


Re: Debugging compiler crashes?

2012-07-02 Thread Trass3r
dmd: glue.c:542: virtual void FuncDeclaration::toObjFile(int): Assertion  
`semanticRun == PASSsemantic3done' failed.

Aborted
wouter@carillon:~/code/d/DustMite$

... and I'm not yet that fluent in D to understand what's going on. Any
ideas?


pass dustmite.d before dsplit.d
known problem, but the error message has changed


Re: Lack of warning messages

2012-06-21 Thread Trass3r

A notice for some unused imports would be great too...


You could create a brute-force tool.
Rip off an import statement at a time and see if it still compiles.
One could probably modify DustMite to do that.


Re: Casting the Result of splitter() into a string array

2012-06-17 Thread Trass3r

If you want to convert a range to an array, use std.array.array


This is a constant source of confusion and it also is a crappy design to  
use a function in a totally different module for this purpose imho.
Can't these Result types get an eval() method and/or be made implicitly  
convertible to an array where appropriate?


The C++ matrix library Eigen uses this approach and it works out  
fantastically.
a*b returns an object representing this expression. If I do want to use  
this I write 'auto c=a*b;'.
If I want the result I can explicitly use its eval() method (which is  
especially useful inside a bigger expression) or something like 'Matrix  
c=a*b;' which also evaluates the expression.


Re: align(16) struct member throws an exception with movdqa

2012-06-14 Thread Trass3r

Cause align doesn't work the way you think it does.
In fact I still don't understand how it works at all.


The language align keyword can only reduce the alignment from the  
platform default (typically 8).  A serious flaw if you ask me . . . .


The doc page doesn't even clearly state this, it is incomprehensible imo:  
http://dlang.org/attribute.html#align


"align by itself sets it to the default, which matches the default member  
alignment of the companion C compiler. Integer specifies the alignment  
which matches the behavior of the companion C compiler when non-default  
alignments are used."
What the heck is this supposed to mean? It sounds like in any case the C  
compiler's value is used and the attribute is completely  
superfluous/useless.


Re: align(16) struct member throws an exception with movdqa

2012-06-11 Thread Trass3r
I think it has been fixed for the next version of DMD already. Any idea  
why align isn't letting me use movdqa?


Cause align doesn't work the way you think it does.
In fact I still don't understand how it works at all.


Re: align(16) struct member throws an exception with movdqa

2012-06-11 Thread Trass3r

import std.stdio, core.simd;

void main()
{   int4 v;
}

Internal error: ..\ztc\cgcod.c 1447
Building Debug\dtest1.exe failed!


Works fine on Linux.

Maybe the 32Bit check doesn't work for Windoze?
-m32 on Linux yields Error: SIMD vector types not supported on this  
platform


Re: align(16) struct member throws an exception with movdqa

2012-06-11 Thread Trass3r

test code please


Re: std.mmfile issues

2012-05-14 Thread Trass3r
I found out that OpenFileMapping is not needed and CreateFileMapping is  
sufficient. I managed to code this with std.c.windows only however  
MmFile is not working even with simplest examlple maybe a bug under win  
7?


Possible. Feel free to file a bug report or create a pull request.


Re: undefined reference - Derelict2

2012-05-07 Thread Trass3r
Though I was under the impression that the new Derelict2 hierarchy / d  
interface files in Derelict2/import reduced the neccesity for command  
line arguments, that is a Derelict related question.


You may try to use --chatty and compare the output.


Re: How to pass list of strings as compile-time parameters?

2012-04-24 Thread Trass3r

bool compareByMemb(string[] ignores, T)(T obj1, T obj2) {
foreach (name; __traits(getAllMembers, T)) {
...
}


In this particular case you could try

foo(T, U...)(T obj1, T obj2, U ignores)


Re: this() const

2012-04-15 Thread Trass3r

Am 15.04.2012, 21:20 Uhr, schrieb sclytrack :



this( const size_t step) const
{
this.step = step;
}


Error: cannot modify const/immutable/inout expression this.step


Is this the expected behavior? Thanks.


Yep.


Re: D Dll injection problem

2012-03-28 Thread Trass3r

this works on every dll I try to inject apart from dll's written in D
(starting with dmd version 2,054 or something like that).


If this is a regression, please narrow it down to the exact version.


Re: D Dll injection problem

2012-03-27 Thread Trass3r
I inject it but it returns nothing and the App(where the dll is  
injected) is hanging( not responding).


Could you try it maybe?
I would like to know whether it's a Problem with D or with me.


Are dlls without injection working?


Re: D Dll injection problem

2012-03-27 Thread Trass3r

Maybe it's because I have no def file.


Very possible.
Just pass it to dmd like the other files.
Or try the new -shared flag.


Re: Vector operations optimization.

2012-03-23 Thread Trass3r

The flags you want are -O, -inline -release.

If you don't have those, then that might explain some of the slow down
on slicing, since -release drops a ton of runtime checks.


-noboundscheck option can also speed up things.


Re: anything that would provide support for zip filesystem?

2012-03-22 Thread Trass3r

I guess Tango provides something like that via the VFS stuff.

https://github.com/SiegeLord/Tango-D2 resp.
https://github.com/mtachrono/tango


Re: Vector operations optimization.

2012-03-22 Thread Trass3r
What is the status at the moment? What compiler and with which compiler  
flags I should use to achieve maximum performance?


In general gdc or ldc. Not sure how good vectorization is though, esp.  
auto-vectorization.
On the other hand the so called vector operations like a[] = b[] + c[];  
are lowered to hand-written SSE assembly even in dmd.


Re: preprocessor pass equivalent?

2012-03-15 Thread Trass3r

There's a pull request to help with debugging string mixins:
https://github.com/D-Programming-Language/dmd/pull/426


Re: htod - const

2012-03-06 Thread Trass3r
Am 06.03.2012, 20:13 Uhr, schrieb maarten van damme  
:



I wouldn't say that it sucks. It has really helped a lot in
porting some simple header files. It  goes terribly bad on the more  
complex though.


Sadly, using regular expressions is much more efficient.
At least those don't destroy the source by removing const, comments,  
evaluating preprocessor directives, etc.


Re: htod - const

2012-03-06 Thread Trass3r

Why is 'const' removed?


cause htod sucks.
D1 didn't have const and htod wasn't updated for ages.


Re: Dumb question about git

2012-03-01 Thread Trass3r

OK, so what's the right way to do it then? I have some changes in a
branch, but master has been updated since, so I want to merge in the
latest updates so that the branch changes are compatible with the latest
code.


I use a quite crappy way to rebase my feature branch:
git stash && git checkout master && git pull -v --rebase && git rebase  
master myworkingbranch


There's probably some redundancy or whatever here, but at least it works ^^


Re: Random behavior using a wrapped C library

2012-02-28 Thread Trass3r

A blocker for using x64 on linux then.


Use gdc. Better codegen anyway.


Re: Random behavior using a wrapped C library

2012-02-28 Thread Trass3r

http://d.puremagic.com/issues/show_bug.cgi?id=5570


Re: produced binary is quite big

2012-02-26 Thread Trass3r
You may try -L--gc-sections (in case of gdc in combination with  
-ffunction-sections -fdata-sections) and -L-s


Re: Make alias parameter optional?

2012-02-25 Thread Trass3r

void foo(T, T2, alias thing = (){})(T a, T2 b)
{
thing();
}

void bar(){}

void main()
{
foo!(int,int,bar)(1,2);
foo(1,2);
}


Re: Executable size when compiling with GDC

2012-02-21 Thread Trass3r

Lots of symbols and stuff.
You can get it down with -ffunction-sections -fdata-sections  
-Wl,-s,--gc-sections
Phobos should also be compiled with -ffunction-sections -fdata-sections to  
get the whole effect though.


Re: Everything on the Stack

2012-02-20 Thread Trass3r

scope auto e1 = new EntryInt();
Foo = e1.toFoo();


You don't need auto there.
And scope is deprecated, use std.typecons' scoped


Re: Compiling Lua for D

2012-02-15 Thread Trass3r
I guess GDC uses COFF? That would definitely be handy... although I  
couldn't compile and debug from VS anymore in that case, and that would  
be unfortunate^^"


Just recently Rainer added gdc support to cv2pdb.


Re: D for game Development

2012-02-15 Thread Trass3r

Can I use OpenGL or DirectX with D?


Of course.

E.g. there's a D1 game engine: http://yage3d.net
I think http://3d.benjamin-thaut.de/?p=16 is D2, but it's rendering code  
only.


Re: Compiling Lua for D

2012-02-15 Thread Trass3r
LuaD works fine, but I'd rather learn to compile stuff like this myself.  
It will get me further in the long run^^


Try to switch to gdc.
dmc, optlink & Co. must die a bloody death anyway :)


Re: Templated aliases name in compilation error output

2012-02-12 Thread Trass3r

dmd simply doesn't keep those information about aliases.


Re: Struct "inheritance"

2012-02-04 Thread Trass3r
So why not just use classes? I've understood it as there may be a  
performance gain by using structs over classes, and in my program Point  
and Coordinate are used heavily.


The other big difference is value vs. reference type.
You can use alias this to achieve something like "struct inheritance".


Re: i18n

2012-02-03 Thread Trass3r
Thanks a lot, So I just need to "detect" user locale using How to do  
that?


You can always use the functions you would use in C.


Re: linker @ meaning and how to compile static libs

2012-02-03 Thread Trass3r
The main question is how do I either compile the library with the right  
version suffix (@12)

Or get the linker to use the right version suffix (@8)


That's no version suffix. It's the number of bytes of the arguments IIRC.
Windows calling convention.


Re: i18n

2012-02-03 Thread Trass3r
I deduce so that there is no "official" support for that. If it's, it's  
a pain.


Pain? Writing such a system can be done in a couple of lines.


Re: opAssign and references

2012-01-31 Thread Trass3r
I am using DMD 2.057 on Ubuntu 64bit. Are you sure that it does not  
work? Can anyone reproduce the error?


import std.variant;
struct Foo {
 Variant a;
 ref Variant refA(){
 return a;
 }
}
void main(){
 Foo f1;
 f1.refA() = 24;
}


Compiles fine on Ubuntu x64 with git dmd and -m(32|64)


Re: Class Initialization

2012-01-31 Thread Trass3r

*whispers gee dee c*


windows binaries please...


Seek and you shall find.
https://bitbucket.org/goshawk/gdc/downloads


Re: Class Initialization

2012-01-31 Thread Trass3r

I was reading the C++ Object Model book recently (well, I'm still
reading) and was amazed at how many edge-cases there are in C++, and
how lucky I am to be using D. Well, minus the Optlink that is. :)


*whispers gee dee c*


Re: regex: force entire string to match

2012-01-31 Thread Trass3r

I want to write a regex to check if a whole string is a number.
With my current regex("[0-9]+") numbers will be carved out of things like
"aaa456" (hit: 456) and I circumvent this by checking the lengths for
inequality, which is stupid. My regex is surely missing something?


Try ^ and $ if applicable. These match start and end of a line.


Re: Scoped Class Instance

2012-01-31 Thread Trass3r

However, I cannot, by default, scope my custom allocations.
Any ideas?


std.typecons.scoped


Re: Chained Catch Statements

2012-01-30 Thread Trass3r

What is the idiom for handling
a case where multiple exceptions of different types may be thrown?


I think you could catch a common baseclass like Exception and test if it's  
a specific Exception by casting.


Re: dmd & gdc

2012-01-26 Thread Trass3r

I looked up ldc recently, and it seems that it hasn't been updated for
years. Seems that gdc is the only other D compiler that's still actively
maintained.


Please don't spread such misinformation.
https://github.com/ldc-developers/ldc/commits/master


Re: dmd & gdc

2012-01-26 Thread Trass3r

Building gcc in general is a pain. It's just a little less painful on
*nix systems, but still painful.


I can't agree.
The build instructions contain everything. Has been straightforward for me  
right from the beginning.


Re: dmd & gdc

2012-01-26 Thread Trass3r

There is also gdmd : dmd front end that use gdc
It's nothing but a perl script that translates dmd command line 
options into gdc ones.


Re: dmd & gdc

2012-01-26 Thread Trass3r

On Thursday, 26 January 2012 at 11:46:19 UTC, sami wrote:
my question is if there thing i can do with dmd only and visa 
versa?

what the feature of one of them over the other?
what the different between them in term of inline assembly, 
performance, platform and bugs?


They share the frontend, i.e. language support is pretty much the 
same.
dmd's backend is limited both in terms of performance and 
platform support (x86 only), but it compiles D code faster.
gdc inherits gcc's sophisticated optimizer capabilities, but may 
have unique bugs in its glue code.


On Windoze gdc is really preferable cause the dmd/dmc toolchain 
is just crap and doesn't support x64 at all. Building gdc 
yourself is PITA on Win though.

On Linux the difference isn't that big.


Re: Definition of extern(System)?

2012-01-25 Thread Trass3r

I was pretty sure it's somewhere in the spec.


Re: for loop

2012-01-23 Thread Trass3r

void main(){
   for ({int x=0; short y=0;} x < 10; x++, y++){
   }
}


wtf?


Re: for loop

2012-01-22 Thread Trass3r

for (int x = 0, int y = 0; .)


for (int x=0, y=0; ...)


Re: Struct initialization, implicit conversions and delegates

2012-01-16 Thread Trass3r

StringHash sh = "SomeString"; // ok


That's the only thing that works.
An @implicit tag for constructors to allow all implicit conversions would  
really be helpful.


In general we need finer control of implicit conversions.
Just have a look at ProxyOf:  
https://github.com/D-Programming-Language/phobos/pull/300/files#L0R2670


That's madness, all of that code just for getting alias this without  
implicit conversion to the original type.


Re: Problem with interfacing C code to D

2012-01-09 Thread Trass3r

What's the definition of Display?


Re: Ref local variables?

2012-01-08 Thread Trass3r

Sorry, didn't read the rest. ^^


Re: Ref local variables?

2012-01-08 Thread Trass3r

MapTile[] map;  // It's a struct

ref MapTile tile=map[y*w+x];
tile.id=something;
tile.isWall=true;


MapTile* tile = &map[y*w+x];


Re: typedef deprecated - now what ?

2011-12-31 Thread Trass3r

Basically it was deprecated because it's poorly defined and implemented.
There are several types of typedefs that need to be available: parallel,  
opaque, supertype and subtype.

See http://d.puremagic.com/issues/show_bug.cgi?id=5467


Re: typedef deprecated - now what ?

2011-12-30 Thread Trass3r
is there a template or something in phobos to get the same typesafe  
behaviour of good old typedef ?


I've brought this up several times.
People just don't give a shit.

http://d.puremagic.com/issues/show_bug.cgi?id=5467


Re: Reading about D: few questions

2011-12-23 Thread Trass3r

5. Align attribute.

http://dlang.org/attribute.html#align

struct S {
   align(4) byte a; // placed at offset 0
   align(4) byte b; // placed at offset 1
}

Explain this please.


align is a huge mess imo.
"It matches the corresponding C compiler behavior"
So what's the point of align in the first place, if the compiler does what  
it wants anyway, see above?


The only thing that really works is

align(1) struct S {...}

for packed structs.


Re: test if object is instance of class at compile time

2011-12-22 Thread Trass3r

I'd really like to have 'if (instance is ClassType)' syntax in D.


Re: writing iterators without code duplication. inout?

2011-12-21 Thread Trass3r

Can't really answer your original question, but
1. Why don't you use opApply?
2. Why do you use ref int even in the const version?
3. You could also use alias this to allow iteration, don't know if that's  
what you want in general though.


Re: Allocating memory in D shared library when accessed from C++

2011-12-19 Thread Trass3r

Am 19.12.2011, 23:13 Uhr, schrieb Martin Drašar :


Dne 19.12.2011 23:09, Trass3r napsal(a):

It actualy returns a procedure address and the procedure is called. It
lands inside export extern (C) int magicNumber() and crashes when
attempting to allocate memory for Something.


Did you properly initialize druntime?


As I am just starting with D, the most precise answer I can give you is:  
I don't know... how do I tell? Or in another way - the code for D  
library is almost complete except for imports. The rest was done for me  
by Visual D.


It's explained there: http://www.dlang.org/dll.html


Re: Allocating memory in D shared library when accessed from C++

2011-12-19 Thread Trass3r
It actualy returns a procedure address and the procedure is called. It  
lands inside export extern (C) int magicNumber() and crashes when  
attempting to allocate memory for Something.


Did you properly initialize druntime?


Re: Void initialization

2011-12-19 Thread Trass3r

Am 19.12.2011, 13:04 Uhr, schrieb Bear :


Using D1, I have a program that creates tons of float[] ; for performance
reasons, I would like them to be uninitialized.


std.array.uninitializedArray


Re: -D option = Embedded documentation

2011-12-16 Thread Trass3r

Am 16.12.2011, 19:45 Uhr, schrieb dune :


I didn't realize that stuff like this will not work as expected:

[code]
/***
 * Brief summary of what
 * myfunc does, forming the summary section.
 *
 * First paragraph of synopsis description.
 *
 * Second paragraph of
 * synopsis description.
 */

void myfunc() { }

/***
 * This is just some text that
 * should be added to the
 * documentation
 */

// below is the next chunk of code
[/code]

The second block of documentation will not show up.


How is the doc generator supposed to know where that doc fragment is  
supposed to end up?

If it's related to a declaration, put it there.
If it's just a module-level comment, put it into the module doc comment.


Re: -D option = Embedded documentation

2011-12-16 Thread Trass3r
 Page generated by href="http://www.digitalmars.com/d/2.0/ddoc.html";>Ddoc. 

 


Ah looks like that must be updated to dlang.org too


Re: -D option = Embedded documentation

2011-12-16 Thread Trass3r
What I posted was an example, in reality there is tons of code inside  
the d file.


Show the file, or part of it.


Re: -D option = Embedded documentation

2011-12-16 Thread Trass3r

Am 16.12.2011, 17:47 Uhr, schrieb dune :


Never tried this before:

Tried (with D2.057) to use the embedded documentation option with:

/**
 * documentation here
 */

and the html files are generated but they only contain a html skeleton  
and no documentation.


This comment doesn't refer to any code.


Re: Alias/Ref Tuples ?

2011-12-16 Thread Trass3r

I think something like this is implemented in a dmd pull request.


Re: D Grammar Specification

2011-11-29 Thread Trass3r

http://lists.puremagic.com/pipermail/digitalmars-d/2011-March/098950.html


Re: auto

2011-11-24 Thread Trass3r

The type has to be deduced anyway for type checking the
assignment/initialization.


Makes sense. Overseen that.


Re: auto

2011-11-24 Thread Trass3r

Well the runtime performance is equal but of course compilation takes
slightly longer since it has to deduce the type first.


Just curious: I would be surprised if there was actually a measurable  
difference between the two – did you ever try to measure it?


Actually not. Would be interesting, esp. if trySemantic is in the game.


Re: auto

2011-11-24 Thread Trass3r

is there any performance gap using auto instead of int or other
type? For example

int[] ar1 = new int[1000];
auto[] ar2 = new int[1000];

are these equivalent by a perfomance point of view?


Well the runtime performance is equal but of course compilation takes  
slightly longer since it has to deduce the type first.
But in general you should only use auto if it doesn't make your code  
harder to understand (e.g. auto x =  
funcThatDoesCrazyShitYouCantGuessFromTheName(); // so, what's the type of  
x???).


Also it's 'auto ar2' instead of 'auto[] ar2'.


Re: Internal error: ..\ztc\cgcs.c 352

2011-11-22 Thread Trass3r
Please check if your case is equal to  
http://d.puremagic.com/issues/show_bug.cgi?id=4414


Re: Make a variable single-assignment?

2011-11-21 Thread Trass3r

Don't think so.
You could also wrap it in a struct with disabled opAssign, but this would  
also change the type.


Re: immutable & alias this

2011-11-09 Thread Trass3r
test.d(16): Error: cannot implicitly convert expression ([1,2,3]) of  
type int[] to immutable(Typedef!(int[]))


OT: this shows another possible problem.
See http://clang.llvm.org/diagnostics.html, section "Typedef Preservation  
and Selective Unwrapping"


Re: Spurious imports in Phobos ?

2011-11-09 Thread Trass3r
Phobos contains a lot of templates and if a template isn't instantiated  
it won't be compiled. Meaning there can be hidden compile errors if you  
start to remove imports and they will not show until a template that  
uses something from the import is instantiate.


Wouldn't it be possible/better then to move the imports into those  
template functions?


Re: Spurious imports in Phobos ?

2011-11-09 Thread Trass3r
2. what is your opinion about public import ? In C++, "hidden" or  
"implicit" #includes is a common source of compilation problems (order  
of #includes), I tend to think it's a bad thing.


It can be quite useful. I use it often for C library wrappers. As soon as  
you import the wrapper code you automatically import the bindings to be  
able to use constants etc.


Re: .Net

2011-11-09 Thread Trass3r

Am 09.11.2011, 13:39 Uhr, schrieb Reklen :


Is there a project to export D in .Net world? I see this
http://dnet.codeplex.com/
but it seems dead.


Feel free to continue that project ;)
Apart from that you are left with C interface dlls.


Re: web development in D programming

2011-11-09 Thread Trass3r

I am a little disapointed, so if you have many request for a web page
this lib  http://arsdnet.net/dcode/ is usable or not ?

If they are any other method to do a web application in D2 programming
do not hesitate and tell to me which lib used.


There's also a project named Serenity
http://www.digitalmars.com/d/archives/digitalmars/D/Serenity_web_framework_-_early_feedback_wanted_125473.html

But it hasn't been updated in months nor is it mature.

Adam uses his code in production and also provides FastCGI support.


Re: extends and implements

2011-11-07 Thread Trass3r

You can do this and/or use the convention of extends first, implements
second:

class Rectangle : Drawable, IShape, IOtherInterface {}


It's not a convention, the spec demands that.
http://d-programming-language.org/class.html



If you're really concerned about clarity, use comments:

class Rectangle : /* extends */ Drawable,
  /* implements */ IShape
{
}


Good point.


Re: Is this actually valid code?

2011-11-07 Thread Trass3r

Cool stuff, thanks guys. This thing kicks some serious C++ ass. ^^


How? You can use using in C++ to do the same.


Re: Is this actually valid code?

2011-11-07 Thread Trass3r

class Foo
{
@property void test(int) {}
@property int test() { return 1; }
}

class Bar : Foo
{
alias super.test test;
override @property void test(int) {}
void bartest() { auto x = test; }
}

And it actually works! Is this a documented feature?


http://d-programming-language.org/hijack.html


Re: template expressions in C++ to an equivalent in D

2011-10-30 Thread Trass3r

I was thinking about porting http://eigen.tuxfamily.org/index.php in D.


Don't we have a LinAlg library now thx to that GSoC project?

I'm currently on SFML2 but it goes quite fast (thanks to  Trass3r for  
porting SFML to D2 so a big part of the job is done).


You're welcome.


Re: char and string with umlauts

2011-10-20 Thread Trass3r

Make sure your source file is saved in UTF-8 format.


Re: Looking for documentation of D's lower-level aspects.

2011-10-19 Thread Trass3r

Am 20.10.2011, 00:06 Uhr, schrieb Sean Silva :

== Quote from Jesse Phillips (jessekphillip...@gmail.com)'s article

Right now D isn't ready to be used in this fashion


It looks there's a more-or-less functional kernel written in D (and
pretty well documented too):
http://wiki.xomb.org/index.php?title=Main_Page


"You do not need the Tango standard library to compile XOmB as it contains  
its own standard calls and runtime."


Re: Looking for documentation of D's lower-level aspects.

2011-10-18 Thread Trass3r

 ahead = n._next;

The C/C++ equivalent of this is `ahead = n->next;`, or equivalently  
`ahead = (*n).next;`. This is a difference in semantics from C/C++ with  
respect to the `.`---it seems like D turns pointer to struct property  
accesses into property access with indirection.


Yes. It was really dumb to introduce that in C back then cause you can't  
easily change from a pointer to a class to a real class without editing  
all places where it is accessed.
D chose the sane and safer way of letting the compiler figure out what to  
do.


Nowhere that I can recall in Alexandrescu's book talked about this, but  
it's a really big deal!


I can't recall where I read about it back then, but I did know it soon  
after I had started learning D.
Some of the differences to C/C++ are explained there:  
http://www.d-programming-language.org/ctod.html

Though it could use an overhaul.

As for getting rid of the GC, it is theoretically possible.
But nobody has put much effort into making it work yet (cause the only  
application platform is still x86/64).
I guess it will become necessary though once D conquers ARM (we can  
generate code for it with LDC/GDC but druntime isn't ready).


Re: Calling D DLL from C# and passing/retrieving string variables

2011-10-12 Thread Trass3r

[DllImport("mydll.dll",
CallingConvention = CallingConvention.Cdecl,
SetLastError = false, CharSet = CharSet.Auto)]
private static extern bool concatenate(
string str1, // in
string str2, // in
StringBuilder strResult); // out


Question is if that StringBuilder really is equal to a char* in this case.


Re: operator "~" does not check type?

2011-10-12 Thread Trass3r

I believe that the primary reasoning for allowing the implicit conversion
between int and dchar is so that code like this

dchar c = 'a' + 7;


That's a '+' though, not a '~'.

I think it shouldn't be allowed with ~ since it's misleading.
Newbies would probably expect "abc" ~ 10 to yield "abc10" rather than the  
odd "abc\n".


Re: How convice people that D it's wonderfull in a hour ?

2011-10-09 Thread Trass3r
Talk about stuff that's hard to do or impossible in C++ (or just a PITA  
like the whole language) and compare it to some nifty D code.


For example template metaprogramming. No easy way to do template  
constraints, no is expressions nor a proper typeof so you have to use  
specialization a lot.
You could also show something that checks for an "interface" at  
compile-time, like

template isInputRange(R)
{
enum bool isInputRange = is(typeof(
{
R r;  // can define a range object
if (r.empty) {}   // can test for empty
r.popFront(); // can invoke popFront()
auto h = r.front; // can get the front of the range
}()));
}

CTFE is another strong feature.
You could for example show some code that generates Token handling code  
(an enum for the tokens, associative arrays for token 2 string and the  
other way around, etc.) to be used by a lexer without the necessity for a  
DSL like in Clang or a separate tool like dmd.


Re: contrary of std.utf.toUTFz!(const(wchar)*)

2011-10-07 Thread Trass3r

Just wanted to point out how it's implemented with language tools.


Re: contrary of std.utf.toUTFz!(const(wchar)*)

2011-10-07 Thread Trass3r
I feel a little stupid, but how to convert  a wchar* zero terminated  
string into a wstring (DMD 2.055)?


wstring w = cstr[0 .. strlenw(cstr)];


Re: Why an abstract pointer cannot be used as value in an associate array?

2011-09-29 Thread Trass3r

Am 29.09.2011, 06:51 Uhr, schrieb Cheng Wei :


extern(C) {
struct ab;
}

ab*[int] map;

void main() {
map.clear();
}


Cannot be compiled. Why?

Thanks.


Just use void* for opaque pointers in D.


Re: I can't build dsfml2 or derelict.sfml whit dsss

2011-09-22 Thread Trass3r

DSFML2's dsss file is just a remnant from the old DSFML.
Also I don't really update DSFML2 anymore. A SWIG wrapper would be a  
better idea but it's hard to make it use our custom system module instead  
of wrapping the original one.


In general using dsss isn't advisable, since rebuild is horribly outdated.


  1   2   3   4   >