Re: Need help in templates

2011-03-25 Thread Bekenn
On 3/25/2011 3:34 AM, Regan Heath wrote: FYI.. that's uuencoded data: http://en.wikipedia.org/wiki/Uuencoding it's one of the older style encodings used by NNTP. Most readers should support it. Oddly enough, Thunderbird is one that doesn't.

Re: C++ to D: mutable

2011-03-24 Thread Bekenn
On 3/24/2011 12:23 AM, Caligo wrote: Greetings, I have a C++ class that I would like to rewrite it in D. The class has members that are declared as 'mutable'. How do I achieve the same effect in D? if not, what is recommended? You don't. Specific recommendations would depend on how the clas

Re: Bug w/tuple of custom types?

2011-03-24 Thread Bekenn
On 3/23/2011 12:45 PM, Magnus Lie Hetland wrote: Any way to do that without (to be deprecated) typedef? Nothing pretty, at least not yet. bearophile's suggestion is about as close as you can get right now.

Dependencies file format

2011-03-13 Thread Bekenn
After some searching, I found the documentation here: http://d.puremagic.com/issues/show_bug.cgi?id=3122 Shouldn't this be on the web site somewhere?

Re: .di header imports with DLL symbols fails to link

2011-03-12 Thread Bekenn
On 3/12/2011 7:02 PM, Andrej Mitrovic wrote: My commands to compile were: dmd -ofmydll.dll mydll.d dmd -o- -Hdinclude mydll.d dmd driver.d mydll.lib -I%cd%\include Thanks. I've tried several things, but can't get the _D5mydll12__ModuleInfoZ symbol to show up at all. The behavior is the same

Re: .di header imports with DLL symbols fails to link

2011-03-12 Thread Bekenn
On 3/12/2011 5:24 PM, Andrej Mitrovic wrote: driver.obj(driver) Error 42: Symbol Undefined _D5mydll12__ModuleInfoZ --- errorlevel 1 Your dll is exporting a different symbol: _D5mydll3fooFiZi Do you have the .def file and the command line used to build the DLL?

Re: Ranges

2011-03-12 Thread Bekenn
Or, better yet, just read Jonathan's post.

Re: Ranges

2011-03-12 Thread Bekenn
On 3/12/2011 2:02 PM, Jonas Drewsen wrote: Error message: test2.d(13): Error: template std.algorithm.copy(Range1,Range2) if (isInputRange!(Range1) && isOutputRange!(Range2,ElementType!(Range1))) does not match any function template declaration test2.d(13): Error: template std.algorithm.copy(Ran

Re: Points and Vectors in 3D

2011-03-12 Thread Bekenn
On 3/12/2011 2:20 PM, Simon wrote: I've done lots of 3d over the years and used quite a lot of different libraries and I've come to prefer code that makes a distinction between points and vectors. Agreed. This has some nice benefits with operator overloading, as well: vec v = ...;

Re: Some weird crashes

2011-03-08 Thread Bekenn
On 3/8/2011 12:57 PM, simendsjo wrote: One more thing.. Function pointers in structs.. Should they use extern(Windows) too? Yes.

Re: No case ranges in final switches?

2011-03-06 Thread Bekenn
On 3/6/2011 1:11 PM, bearophile wrote: Do you know why final switches disallow case ranges? Case ranges are not bug-prone: void main() { ubyte u; final switch (u) { case 0: .. case 100: break; case 101: .. case 255: break; } } Final

Re: htod and system files

2011-03-05 Thread Bekenn
On 3/4/2011 3:31 PM, simendsjo wrote: The htod page, http://www.digitalmars.com/d/2.0/htod.html, says that system files will be included using the -hs option. htod mysql.h -hs Fatal error: unable to open input file 'sys/types.h' Does it try to find these files through an environment variable?

Re: C const

2011-03-05 Thread Bekenn
On 3/4/2011 11:19 AM, simendsjo wrote: It also says "char const* q". Is "const char*" the same thing in C? For reference: In C, const T* x is the same as T const* x; both declare a mutable pointer to const T. T* const x declares a const pointer to mutable T, for which D has no analogue. I

Re: Parameterized Structs

2011-03-02 Thread Bekenn
On 3/2/2011 8:56 PM, Peter Lundgren wrote: Where can I go to learn about parameterized structs? I can't seem to find any literature on the subject. In particular, what are you allowed to use as a parameter? I would like to define a struct like so: struct MyStruct(T, T[] a) { ... } but I re

Re: Some weird crashes

2011-03-02 Thread Bekenn
On 3/2/11 10:52 AM, simendsjo wrote: I couldn't find a free download for coff2omf, that's why I don't use the supplied .lib. You can use coffimplib: ftp://ftp.digitalmars.com/coffimplib.zip

Re: About const and C functions

2011-03-02 Thread Bekenn
On 3/2/11 4:06 AM, bearophile wrote: Can't D/DMD err on the side of safety and consider the C-style variadic argument as not const, and so produce an error if you give to them something that's D const/immutable (and require a cast there)? (Especially a function like sscanf where the third and

Re: Constructor template -- bug?

2011-03-02 Thread Bekenn
On 3/1/2011 11:47 PM, Jonathan M Davis wrote: I should also point out that there is absolutely no need to use template for what you're trying to do. Just declare the constructor like so: this(string message, string file = __FILE__, size_t line = __LINE__ Throwable next = null) { ... } You are

Constructor template -- bug?

2011-03-01 Thread Bekenn
Code: class MyException : Exception { this(string message, string file, size_t line, Throwable next = null) { super(message, file, line, next); } this(string file = __FILE__, size_t line = __LINE__)(string

Re: comparing pointers passed to and returned from funcs

2011-03-01 Thread Bekenn
On 3/1/2011 4:12 PM, bearophile wrote: Bekenn: I'd remove those parens; you don't want people modifying TRUE or FALSE. Please, show me working code that implements your idea :-) Bye, bearophile Here you go; I only changed the one line. Compiles and works just fine in

Re: About const and C functions

2011-03-01 Thread Bekenn
On 3/1/2011 2:33 PM, bearophile wrote: Do you know why DMD doesn't give a compilation error here? import core.stdc.stdio: sscanf; immutable int value = 5; void main() { sscanf("10".ptr, "%d".ptr,&value); } Bye, bearophile I'm not sure that's checkable. I think this falls squarely into

Re: comparing pointers passed to and returned from funcs

2011-03-01 Thread Bekenn
On 3/1/11 5:31 PM, bearophile wrote: Bekenn: Touche. I'll have to test that out once I get back from work... Sorry for that answer of mine, we are here to learn and cooperate, not to fight :-) It's just I sometimes have problems with const things in D, and sometimes DMD has pro

Re: comparing pointers passed to and returned from funcs

2011-03-01 Thread Bekenn
On 3/1/11 4:12 PM, bearophile wrote: Bekenn: I'd remove those parens; you don't want people modifying TRUE or FALSE. Please, show me working code that implements your idea :-) Touche. I'll have to test that out once I get back from work...

Re: comparing pointers passed to and returned from funcs

2011-03-01 Thread Bekenn
On 3/1/11 3:00 PM, bearophile wrote: const(Foo)* TRUE, FALSE; I'd remove those parens; you don't want people modifying TRUE or FALSE.

Re: string vs. w/char*

2011-03-01 Thread Bekenn
On 3/1/2011 12:25 AM, Tyro[a.c.edwards] wrote: Nevertheless, execution haults at the very next line following/catch and Create() never returns. CreateWindow sends a few messages to your window proc; anything interesting happening there?

Re: Ini parsing library in D ?

2011-02-27 Thread Bekenn
On 2/27/2011 11:04 PM, Tarun Ramakrishna wrote: Hi, Do we have a ini parser in D somewhere ? If not, is there some documentation anywhere that tells one how to wrap a simple C++ library like simple ini ? (Of course it isn't difficult to build a quick parser, just that someone would done this alr

Re: Defining type coercion

2011-02-27 Thread Bekenn
On 2/27/2011 12:10 PM, Peter Lundgren wrote: I'd like to define a type Ordinal which behaves like an int (using a struct or alias) that represents the 26 letters, A-Z, with the numbers 1-26. Then, I would like to be able to coerce between chars and Ordinals appropriately. chars and ints already

Re: Initializing a class pointer

2011-02-26 Thread Bekenn
On 2/26/2011 5:33 PM, Tyro[a.c.edwards] wrote: Ok, that's essentially what I have, except that I used Controller pCtrl vice auto. WinGetLong however, is a template that calls GetWindowLongPtrA() and casts it's result (in this case) to Controller. GetWindowLongPtrA() returns LONG_PTR (aka int) and

Re: Interfacing with c and platform dependent sizes

2011-02-26 Thread Bekenn
On 2/25/2011 7:24 PM, Steven Schveighoffer wrote: BTW, I think long long is a gnu extension, it's not standard C (I don't think long long exists in Visual C for instance). I'm pretty sure it's standard as of C99 (though not yet for C++; that's coming with C++0x). MSVC does indeed support it.

Re: Additional path for libs

2011-02-26 Thread Bekenn
Apologies for the late reply, but this could help: As you've already seen in the other replies, the provided sc.ini file is confounding your attempts at setting the LIB environment variable. However, OPTLINK's search path for sc.ini includes the current directory, so if you're reluctant to alt

wstring format

2011-02-20 Thread Bekenn
Is there a wstring version of string.format? I can't seem to find it anywhere...