Re: From D struct to C struct

2013-11-18 Thread Namespace
On Monday, 18 November 2013 at 10:09:12 UTC, qznc wrote: On Monday, 18 November 2013 at 08:32:11 UTC, Namespace wrote: I found another approach. It avoids the GC and the Heap: A Circular Buffer: http://dpaste.dzfl.pl/cf1e7afb That should work. It is unsafe, but might work in your specific

Re: From D struct to C struct

2013-11-18 Thread Namespace
I found another approach. It avoids the GC and the Heap: A Circular Buffer: http://dpaste.dzfl.pl/cf1e7afb That should work.

Re: From D struct to C struct

2013-11-17 Thread Namespace
On Sunday, 17 November 2013 at 22:25:54 UTC, qznc wrote: On Sunday, 17 November 2013 at 22:11:02 UTC, Namespace wrote: Hello. I have some trouble with C interfacing. I have a C struct with an integer member and I want to wrap this into a D template. But if I want to access the C API, I have

Re: From D struct to C struct

2013-11-17 Thread Namespace
On Sunday, 17 November 2013 at 22:25:54 UTC, qznc wrote: On Sunday, 17 November 2013 at 22:11:02 UTC, Namespace wrote: Hello. I have some trouble with C interfacing. I have a C struct with an integer member and I want to wrap this into a D template. But if I want to access the C API, I have

From D struct to C struct

2013-11-17 Thread Namespace
Hello. I have some trouble with C interfacing. I have a C struct with an integer member and I want to wrap this into a D template. But if I want to access the C API, I have to convert the C struct with the type informations of the D struct. Example: http://dpaste.dzfl.pl/e3d10755 The question

Re: Variable arguments with file and line information?

2013-11-16 Thread Namespace
On Saturday, 16 November 2013 at 22:57:35 UTC, Namespace wrote: Hi. Is it possible to write something like that? void error(Args...)(string msg, Args args, string file = __FILE__, size_t line = __LINE__) { ... } ? Currently not, but how could it be done? I wont like to write

Variable arguments with file and line information?

2013-11-16 Thread Namespace
Hi. Is it possible to write something like that? void error(Args...)(string msg, Args args, string file = __FILE__, size_t line = __LINE__) { ... } ? Currently not, but how could it be done? I wont like to write: error(format(msg, args)); Thanks in advance. :)

Re: Disassembly Tool

2013-11-14 Thread Namespace
On Thursday, 14 November 2013 at 10:35:26 UTC, dennis luehring wrote: agner fogs: http://www.agner.org/optimize/#objconv I love that. :) Thanks. But it is much assembler code. A lot more than my script should contain. Maybe druntime is included? Any idea to cut it down?

Re: Disassembly Tool

2013-11-14 Thread Namespace
On Thursday, 14 November 2013 at 10:35:26 UTC, dennis luehring wrote: Am 14.11.2013 10:48, schrieb Namespace: Since the disassembly on Dpaste doesn't work for me anymore, I'm looking for an alternative. Is there one? And I don't want obj2asm, I'm not willing to pay 15$

Re: Disassembly Tool

2013-11-14 Thread Namespace
On Thursday, 14 November 2013 at 09:55:02 UTC, Tourist wrote: On Thursday, 14 November 2013 at 09:53:42 UTC, Namespace wrote: On Thursday, 14 November 2013 at 09:48:38 UTC, Namespace wrote: Since the disassembly on Dpaste doesn't work for me anymore, I'm looking for an alternative

Re: Disassembly Tool

2013-11-14 Thread Namespace
On Thursday, 14 November 2013 at 09:48:38 UTC, Namespace wrote: Since the disassembly on Dpaste doesn't work for me anymore, I'm looking for an alternative. Is there one? And I don't want obj2asm, I'm not willing to pay 15$. Forget to say: I'm on Windows.

Disassembly Tool

2013-11-14 Thread Namespace
Since the disassembly on Dpaste doesn't work for me anymore, I'm looking for an alternative. Is there one? And I don't want obj2asm, I'm not willing to pay 15$.

Re: sort(charArray) doesn't work

2013-11-13 Thread Namespace
On Wednesday, 13 November 2013 at 10:58:02 UTC, bearophile wrote: Uplink_Coder: sort doesn't work on an primitive Array ? Is that normal please look @http://www.dpaste.dzfl.pl/961286e1 because I don't know what i'm doing worng Thanks in Advance :D One way to solve your char[]: return c

Re: Module or Dictionary corrupt

2013-11-08 Thread Namespace
On Thursday, 7 November 2013 at 04:50:48 UTC, evilrat wrote: On Wednesday, 6 November 2013 at 10:32:01 UTC, Namespace wrote: On Wednesday, 6 November 2013 at 10:21:38 UTC, evilrat wrote: On Wednesday, 6 November 2013 at 10:13:07 UTC, Namespace wrote: Should I open a bug for this? you should

Dr. Memory with D

2013-11-08 Thread Namespace
How did I use Dr. Memory with D applications? Every time I try it, my application crash and I get leak errors (maybe because of the GC). My test code is this: import std.stdio; void main() { } So how can I configure Dr. Memory for D?

Re: struct Unique(T)

2013-11-07 Thread Namespace
On Thursday, 7 November 2013 at 18:19:35 UTC, ChrisG wrote: On Thursday, 7 November 2013 at 09:51:38 UTC, Namespace wrote: Dgame use the SDL also and needed therefore (as you do) shared and unique pointers (mostly shared). So I wrote my own versions and like to share them with you, maybe it

Re: struct Unique(T)

2013-11-07 Thread Namespace
On Thursday, 7 November 2013 at 00:07:25 UTC, ChrisG wrote: Hi, I've been following the D language off and on for several years, have read Andrei's D book, but haven't ever posted here before. Mostly, I come from a C++ and C# background. Recently, I was playing with D using the derelict binding

Re: Limiting template functions to template instantiations of a struct

2013-11-06 Thread Namespace
On Wednesday, 6 November 2013 at 22:43:18 UTC, Dicebot wrote: On Wednesday, 6 November 2013 at 22:41:08 UTC, Atila Neves wrote: I know, but I keep having to refer back to that and even then I didn't know about the syntax these guys just posted! ;) Well, it is mentioned in the list of `is` usag

Re: Limiting template functions to template instantiations of a struct

2013-11-06 Thread Namespace
On Wednesday, 6 November 2013 at 13:00:17 UTC, Atila Neves wrote: The title isn't very clear but I wasn't sure how to phrase it without code. Basically what I want to do is this (won't compile): struct Foo(int N) { } void func(T)(T obj) if(is(T:Foo)) { } void func(T)(T obj) if(!is(T:Foo)) {

Re: Module or Dictionary corrupt

2013-11-06 Thread Namespace
On Wednesday, 6 November 2013 at 10:21:38 UTC, evilrat wrote: On Wednesday, 6 November 2013 at 10:13:07 UTC, Namespace wrote: Should I open a bug for this? you should fix ur sc.ini first to use visual studio linker for x64 and optlink for x86, you can use dmd 2.064.2 installer now to do so

Re: Module or Dictionary corrupt

2013-11-06 Thread Namespace
On Wednesday, 6 November 2013 at 01:04:10 UTC, Jonathan M Davis wrote: On Wednesday, November 06, 2013 00:22:13 Namespace wrote: OPTLINK (R) for Win32 Release 8.00.13 Copyright (C) Digital Mars 1989-2010 All rights reserved. http://www.digitalmars.com/ctg/optlink.html Debug\Foo.obj Offset

Module or Dictionary corrupt

2013-11-05 Thread Namespace
OPTLINK (R) for Win32 Release 8.00.13 Copyright (C) Digital Mars 1989-2010 All rights reserved. http://www.digitalmars.com/ctg/optlink.html Debug\Foo.obj Offset 0H Record Type 0064 Error 138: Module or Dictionary corrupt Building Debug\Foo.exe failed! That's what I get when I compile with-

Re: Current size of GC memory

2013-11-05 Thread Namespace
On Tuesday, 5 November 2013 at 19:49:06 UTC, Sean Kelly wrote: On Monday, 4 November 2013 at 22:25:14 UTC, Rainer Schuetze wrote: On 04.11.2013 11:23, Namespace wrote: And how can I use it? import gc.proxy; doesn't work. You need to add /src/druntime/src to the import search paths.

Re: Current size of GC memory

2013-11-04 Thread Namespace
On Monday, 4 November 2013 at 06:38:41 UTC, Rainer Schuetze wrote: On 03.11.2013 19:53, Namespace wrote: On Sunday, 3 November 2013 at 13:05:08 UTC, Namespace wrote: Is there a way to find out how much memory the GC used currently? Does not seem to be possible. Would have been nice

Re: Current size of GC memory

2013-11-03 Thread Namespace
On Sunday, 3 November 2013 at 13:05:08 UTC, Namespace wrote: Is there a way to find out how much memory the GC used currently? Does not seem to be possible. Would have been nice.

Current size of GC memory

2013-11-03 Thread Namespace
Is there a way to find out how much memory the GC used currently?

Re: Trait keyword.

2013-11-02 Thread Namespace
On Saturday, 2 November 2013 at 21:28:46 UTC, Adam D. Ruppe wrote: On Saturday, 2 November 2013 at 20:45:28 UTC, TheFlyingFiddle wrote: I'm basically wondering why the __traits keyword looks so horrible. I think it looks beautiful and wished all the keywords used the leading underscores. Th

Re: new Type[count] takes too much?

2013-11-01 Thread Namespace
It is. I don't know if it is fixed already, and I don't have the time to search for the thread. But afaik monarch filled the bug.

Re: Intelligent Scope Hierarchy

2013-11-01 Thread Namespace
On Friday, 1 November 2013 at 05:49:04 UTC, Stretto wrote: On Thursday, 31 October 2013 at 22:03:18 UTC, Namespace wrote: The 'it' property is only some 'singleton' approach. You can write: void foo() { auto buffer = Mallocator.allocate(42); /// ... many code } A

Re: new Type[count] takes too much?

2013-10-31 Thread Namespace
On Thursday, 31 October 2013 at 23:48:19 UTC, Jonathan M Davis wrote: On Thursday, October 31, 2013 23:06:22 Namespace wrote: On Thursday, 31 October 2013 at 09:53:39 UTC, Jonathan M Davis wrote: > On Thursday, October 31, 2013 10:15:51 Namespace wrote: >> I'm sure we ha

Re: new Type[count] takes too much?

2013-10-31 Thread Namespace
On Thursday, 31 October 2013 at 09:53:39 UTC, Jonathan M Davis wrote: On Thursday, October 31, 2013 10:15:51 Namespace wrote: I'm sure we had already this conversation but I don't find the thread. T[] buffer = new T[N]; assumes more space than stated (in average 2010 elements more.

Re: Intelligent Scope Hierarchy

2013-10-31 Thread Namespace
The 'it' property is only some 'singleton' approach. You can write: void foo() { auto buffer = Mallocator.allocate(42); /// ... many code } And at the end of the scope buffer is cleared because Mallocator's destructor call deallocateAll (if I'm not wrong).

Re: new Type[count] takes too much?

2013-10-31 Thread Namespace
On Thursday, 31 October 2013 at 10:12:10 UTC, Jonathan M Davis wrote: On Thursday, October 31, 2013 10:59:48 Namespace wrote: On Thursday, 31 October 2013 at 09:48:23 UTC, safety0ff wrote: > On Thursday, 31 October 2013 at 09:15:53 UTC, Namespace > wrote: >> I'm sure we

Re: new Type[count] takes too much?

2013-10-31 Thread Namespace
On Thursday, 31 October 2013 at 09:48:23 UTC, safety0ff wrote: On Thursday, 31 October 2013 at 09:15:53 UTC, Namespace wrote: I'm sure we had already this conversation but I don't find the thread. T[] buffer = new T[N]; assumes more space than stated (in average 2010 elements

Re: new Type[count] takes too much?

2013-10-31 Thread Namespace
On Thursday, 31 October 2013 at 09:27:11 UTC, bearophile wrote: Namespace: T[] buffer = new T[N]; assumes more space than stated (in average 2010 elements more. See: http://dpaste.dzfl.pl/af92ad22c). It behaves exactly like reserve and that is IMO wrong. If I reserve memory with

new Type[count] takes too much?

2013-10-31 Thread Namespace
I'm sure we had already this conversation but I don't find the thread. T[] buffer = new T[N]; assumes more space than stated (in average 2010 elements more. See: http://dpaste.dzfl.pl/af92ad22c). It behaves exactly like reserve and that is IMO wrong. If I reserve memory with buffer.reserve(N)

Re: How to get a substring?

2013-10-26 Thread Namespace
On Saturday, 26 October 2013 at 22:17:33 UTC, Ali Çehreli wrote: On 10/26/2013 02:25 PM, Namespace wrote: On Saturday, 26 October 2013 at 21:23:13 UTC, Gautam Goel wrote: Dumb Newbie Question: I've searched through the library reference, but I haven't figured out how to extract a

Re: How to get a substring?

2013-10-26 Thread Namespace
On Saturday, 26 October 2013 at 21:23:13 UTC, Gautam Goel wrote: Dumb Newbie Question: I've searched through the library reference, but I haven't figured out how to extract a substring from a string. I'd like something like string.substring("Hello", 0, 2) to return "Hel", for example. What met

Re: Trouble with destroy

2013-10-25 Thread Namespace
On Friday, 25 October 2013 at 11:10:03 UTC, Dicebot wrote: On Friday, 25 October 2013 at 07:29:16 UTC, Namespace wrote: Because this solution does not work anymore with dmd 2.064 beta: Are there any other tips and tricks? File regression and write to dmd beta mail list. It is clearly lack of

Re: Trouble with destroy

2013-10-25 Thread Namespace
On Monday, 23 September 2013 at 19:11:53 UTC, Namespace wrote: On Monday, 23 September 2013 at 19:06:48 UTC, Namespace wrote: Code: import std.stdio; struct A { public: int[4] val; alias val this; } void main() { A a; a.destroy(); } /d824

Re: GhostDoc for VisualD?

2013-10-24 Thread Namespace
On Thursday, 24 October 2013 at 11:59:37 UTC, qznc wrote: On Wednesday, 23 October 2013 at 15:56:33 UTC, Namespace wrote: Is there anything like this for VisualD? As far as I understand the GhostDoc website it generates prose comments from the type information? The only reason I can think

GhostDoc for VisualD?

2013-10-23 Thread Namespace
Is there anything like this for VisualD?

Re: Questions about VisualD

2013-10-17 Thread Namespace
On Thursday, 17 October 2013 at 18:18:39 UTC, Rainer Schuetze wrote: On 17.10.2013 00:18, Namespace wrote: I've clicked on "Build Phobos browse info" and now I have absolute no idea how I can restore my old class view for my current project. Any suggestions? You want to re

Re: Questions about VisualD

2013-10-17 Thread Namespace
On Thursday, 17 October 2013 at 18:18:39 UTC, Rainer Schuetze wrote: On 17.10.2013 00:18, Namespace wrote: I've clicked on "Build Phobos browse info" and now I have absolute no idea how I can restore my old class view for my current project. Any suggestions? You want to re

Re: Questions about VisualD

2013-10-17 Thread Namespace
On Wednesday, 16 October 2013 at 22:18:57 UTC, Namespace wrote: I've clicked on "Build Phobos browse info" and now I have absolute no idea how I can restore my old class view for my current project. Any suggestions? And it seems that VisualD ignores all of my Tasks. My Tasklist

Re: cannot call impure function ~this

2013-10-17 Thread Namespace
In this case, the created struct literal A() will be moved out to the function getA(). So dtor is not called and compiler should not cause "cannot call impure function" error. I filed a bug report and posted possible compiler fix. http://d.puremagic.com/issues/show_bug.cgi?id=11286 https://git

Questions about VisualD

2013-10-16 Thread Namespace
I've clicked on "Build Phobos browse info" and now I have absolute no idea how I can restore my old class view for my current project. Any suggestions? And it seems that VisualD ignores all of my Tasks. My Tasklist is always empty, whats wrong? Or is this not implemented?

Re: cannot call impure function ~this

2013-10-16 Thread Namespace
On Wednesday, 16 October 2013 at 07:32:27 UTC, monarch_dodra wrote: On Wednesday, 16 October 2013 at 07:27:25 UTC, Namespace wrote: On Wednesday, 16 October 2013 at 07:23:45 UTC, monarch_dodra wrote: On Tuesday, 15 October 2013 at 21:37:40 UTC, Namespace wrote: I get this error: /d701

Re: cannot call impure function ~this

2013-10-16 Thread Namespace
On Wednesday, 16 October 2013 at 07:23:45 UTC, monarch_dodra wrote: On Tuesday, 15 October 2013 at 21:37:40 UTC, Namespace wrote: I get this error: /d701/f223.d(11): Error: pure function 'f223.getA' cannot call impure function 'f223.A.~this' with this code: -

cannot call impure function ~this

2013-10-15 Thread Namespace
I get this error: /d701/f223.d(11): Error: pure function 'f223.getA' cannot call impure function 'f223.A.~this' with this code: import std.stdio; struct A { public: ~this() { writeln("DTor"); } } A getA() pure nothrow { return A(); } voi

Re: Beta problems

2013-10-13 Thread Namespace
Nice try. I get another error which is maybe related. core/memory.d with nothing else than import std.array causes D:\D\dmd2\windows\bin\..\..\src\phobos\std\array.d(15): Error: module memory fro m file core\memory.d must be imported as module 'memory' And with core/all.d: module

Re: Beta problems

2013-10-12 Thread Namespace
Forget to say: I use VisualD.

Beta problems

2013-10-12 Thread Namespace
I can't reproduce the error but with the current beta I get in a specific project this output: Compiling Audio\Core\core.d... D:\D\dmd2\windows\bin\..\..\src\phobos\std\array.d(15): Error: importing package 'memory' requires a 'package.d' file which cannot be found in 'core\memory\package

Re: Method of another module is callable, even if they is private.

2013-10-12 Thread Namespace
On Saturday, 12 October 2013 at 19:07:44 UTC, Andrej Mitrovic wrote: On 10/12/13, Namespace wrote: Bug or feature? :P Has to be a bug. Reduced: - module a; import b; void main() { auto s = S(); auto f = &s.f; // no error f(); // no error auto sf = &S.sf;

Method of another module is callable, even if they is private.

2013-10-12 Thread Namespace
A.d: import B; class Foo { public: void call(Bar b) { b.test(42); } } void main() { Bar b = new Bar(); Foo f = new Foo(); f.call(b); } B.d: import std.stdio; class Bar { private: void test(int id) {

Re: My design need friends

2013-10-11 Thread Namespace
On Friday, 11 October 2013 at 22:39:18 UTC, Namespace wrote: On Sunday, 6 October 2013 at 13:11:02 UTC, Andrej Mitrovic wrote: On 10/6/13, Namespace wrote: And I should write a blog post about your and my solution. :) Let me try to hack on __PRETTY_FUNCTION__ first and I'll post a wo

Re: My design need friends

2013-10-11 Thread Namespace
On Sunday, 6 October 2013 at 13:11:02 UTC, Andrej Mitrovic wrote: On 10/6/13, Namespace wrote: And I should write a blog post about your and my solution. :) Let me try to hack on __PRETTY_FUNCTION__ first and I'll post a working example here soon. Is there something new?

Re: Linker error: Symbol Undefined

2013-10-11 Thread Namespace
o file that you told it it could expect to find. There's no bug in the compiler or linker, just your usage of mis-matched code. On 10/11/13 11:39 AM, Namespace wrote: Hey, I'm curious about this linker error: OPTLINK (R) for Win32 Release 8.00.13 Copyright (C) Digital Mars 1989-2

Re: Linker error: Symbol Undefined

2013-10-11 Thread Namespace
Ok, that is what I wanted to hear.

Re: Linker error: Symbol Undefined

2013-10-11 Thread Namespace
It's annoying and I don't get it. What is the problem of Optlink? I tried version(unittest) instead of debug. It works then with -debug, but if you compile with -unittest you get the same error.

Linker error: Symbol Undefined

2013-10-11 Thread Namespace
Hey, I'm curious about this linker error: OPTLINK (R) for Win32 Release 8.00.13 Copyright (C) Digital Mars 1989-2010 All rights reserved. http://www.digitalmars.com/ctg/optlink.html bar.obj(bar) Error 42: Symbol Undefined _D3foo1A6__dtorMFZv --- errorlevel 1 foo.d: debug import std.stdio

Re: Call a function with a function pointer

2013-10-10 Thread Namespace
import std.stdio; void foo1(void function(void*) fp) { } void foo2(void function(int) fp) { } void foo3(void*) { } void main() { foo1((void* ptr) => ( assert(ptr is null) )); foo2((int a) => ( a + 1 )); /// Fails: Error: function foo2 (void function(int) fp) is not callable using

Re: Call a function with a function pointer

2013-10-10 Thread Namespace
On Thursday, 10 October 2013 at 15:15:45 UTC, bearophile wrote: Namespace: You mean like this? void foo(T)(extern(C) void function(T*) func) { } That prints: Error: basic type expected, not extern In theory that's correct, in practice the compiler re

Re: Call a function with a function pointer

2013-10-10 Thread Namespace
On Thursday, 10 October 2013 at 14:44:00 UTC, Dicebot wrote: On Thursday, 10 October 2013 at 14:40:09 UTC, Namespace wrote: Example? I do not use lambdas often. void foo(T)(void function(T*) test) { } extern(C) void bar(int*) { } void main() { foo( (int* a) => bar(a) ); } I do

Re: Call a function with a function pointer

2013-10-10 Thread Namespace
On Thursday, 10 October 2013 at 14:28:20 UTC, Dicebot wrote: On Thursday, 10 October 2013 at 14:13:47 UTC, Namespace wrote: I have this function: void foo(T)(void function(T*) test) { } And want to call it with a C function: foo!(SDL_Surface)(SDL_FreeSurface); but I get

Re: Call a function with a function pointer

2013-10-10 Thread Namespace
On Thursday, 10 October 2013 at 14:26:37 UTC, Benjamin Thaut wrote: Am 10.10.2013 16:13, schrieb Namespace: I have this function: void foo(T)(void function(T*) test) { } And want to call it with a C function: foo!(SDL_Surface)(SDL_FreeSurface); but I get: Fehler1

Call a function with a function pointer

2013-10-10 Thread Namespace
I have this function: void foo(T)(void function(T*) test) { } And want to call it with a C function: foo!(SDL_Surface)(SDL_FreeSurface); but I get: Fehler 1 Error: foo (void function(SDL_Surface*) test) is not callable using argument types (extern (C) void function(SDL_Surf

Error: struct Foo(T = int) is used as a type

2013-10-09 Thread Namespace
import std.stdio; struct Foo(T = int) { } void main() { Foo f; } Error: Error: struct Foo(T = int) is used as a type If I change Foo f into Foo!() f it works. Is the compiler not able to see that this is not necessary, since I have a default type?

Re: My design need friends

2013-10-06 Thread Namespace
This is also nice. My final construct now looks like this: Friend: module Core.Friend; struct Friend { public: immutable string FriendClass; immutable string FriendMethod; this(string friendClass, string friendMethod = null) { this.FriendClass = frie

Re: My design need friends

2013-10-05 Thread Namespace
Even better as mixin template: Accessor: module Core.Accessor; import std.stdio; import std.string : format; import Core.Friend; mixin template Accessor(T) { public: void friendCall(string method, Request, Args...)(ref const Request caller, Args args) { auto friends = _

Re: My design need friends

2013-10-05 Thread Namespace
I have now a solution. A bit dirty but it's the D magic I expected. New file: module Core.Friend; struct Friend { public: immutable string friend; } Drawable looks now like this: module Bar.Drawable; import Core.Friend; @Friend("Window") interface Drawable { protected:

Re: My design need friends

2013-10-05 Thread Namespace
On Saturday, 5 October 2013 at 21:57:58 UTC, Namespace wrote: On Saturday, 5 October 2013 at 21:46:19 UTC, Adam D. Ruppe wrote: It isn't really a fix, but in these situations what I've been doing in my code is just writing: // don't use this /* private */ final public void

Re: My design need friends

2013-10-05 Thread Namespace
On Saturday, 5 October 2013 at 21:46:19 UTC, Adam D. Ruppe wrote: It isn't really a fix, but in these situations what I've been doing in my code is just writing: // don't use this /* private */ final public void foo() {} final makes sure it doesn't get overridden wrongly, and then the comment

My design need friends

2013-10-05 Thread Namespace
Hello. I hope one of you has a good idea to solve my design problem. I have 3 files in two different sub packages. Package Bar has the interface Drawable: module Bar.Drawable; interface Drawable { protected: void _render(); package: final void render() { th

Re: Visual Studio - formatting

2013-09-27 Thread Namespace
3. I have no symbol view. Or better: I see nothing there. And that is the most painfull thing. That was my fault. I've deactivated the JSON output for some reason. On Friday, 27 September 2013 at 19:37:55 UTC, Namespace wrote: On Friday, 27 September 2013 at 13:47:21 UTC, Rainer Sch

Re: Visual Studio - formatting

2013-09-27 Thread Namespace
On Friday, 27 September 2013 at 13:47:21 UTC, Rainer Schuetze wrote: Could you give an example where it does not meet your expectation? Sure. 1. I cannot format the whole file 2. I have no setting to format automatically. 3. I have no symbol view. Or better: I see nothing there. And that is th

Visual Studio - formatting

2013-09-27 Thread Namespace
On Friday, 27 September 2013 at 10:06:31 UTC, Dicebot wrote: On Friday, 27 September 2013 at 10:00:04 UTC, Namespace wrote: I've installed the last version (12.11) but I see nothing inside the symbol view. What wrong? If I press "Ctrl + Alt + G" I get often the message that no

Code::Blocks - Symbol View

2013-09-27 Thread Namespace
I've installed the last version (12.11) but I see nothing inside the symbol view. What wrong? If I press "Ctrl + Alt + G" I get often the message that no functions could be parsed, or in some other files I see only a few of them. Can I improve this?

Re: Trouble with destroy

2013-09-23 Thread Namespace
On Monday, 23 September 2013 at 19:06:48 UTC, Namespace wrote: Code: import std.stdio; struct A { public: int[4] val; alias val this; } void main() { A a; a.destroy(); } /d824/f630.d(13): Error: template object.destroy matches more than one

Trouble with destroy

2013-09-23 Thread Namespace
Code: import std.stdio; struct A { public: int[4] val; alias val this; } void main() { A a; a.destroy(); } /d824/f630.d(13): Error: template object.destroy matches more than one template declaration, /opt/compilers/dmd2/include/object.di(593)

Re: Is there a way to see if .init has been set by the user?

2013-09-21 Thread Namespace
On Saturday, 21 September 2013 at 14:11:44 UTC, simendsjo wrote: On Saturday, 21 September 2013 at 13:55:00 UTC, Dicebot wrote: On Saturday, 21 September 2013 at 13:48:00 UTC, simendsjo wrote: On Saturday, 21 September 2013 at 13:38:44 UTC, Dicebot wrote: On Saturday, 21 September 2013 at 13:30

Re: Linker error

2013-09-21 Thread Namespace
On Wednesday, 29 May 2013 at 21:17:29 UTC, Namespace wrote: Why is the phobos lib automatically detected with dmd 2.062 , but not with 2.063? Any other answer? I have the same problem again. And I hate it.

Re: References

2013-09-20 Thread Namespace
On Friday, 20 September 2013 at 10:29:24 UTC, andrea9940 wrote: On Friday, 20 September 2013 at 09:44:51 UTC, Namespace wrote: This prints 'ref' if you change func(A a) to func(const A a) the match of const ref isn't prefered over A a because const need an implicit conversion.

Re: References

2013-09-20 Thread Namespace
On Friday, 20 September 2013 at 09:36:18 UTC, andrea9940 wrote: Running this code I would expect to get "ref" three times, but ... --- import std.stdio; struct A { int[128] data; ref A opAdd(const ref A a) { A cp = this; cp.data[] += a.data[];

Re: cast(immutable) vs extra variable

2013-09-19 Thread Namespace
On Thursday, 19 September 2013 at 16:47:13 UTC, Daniel Davidson wrote: Multi-part question: 1) Why does the last line fail? If cast to immutable how is it different than z? I know it is related to the ref. I'm using ref because I think it is likely more efficient - so assume the char[16] were

Re: Array length : size_t

2013-09-19 Thread Namespace
On Thursday, 19 September 2013 at 11:10:08 UTC, bearophile wrote: Namespace: So to!int is safer but slower and a cast would be unsafe but faster? Right. Bye, bearophile Thanks!

Re: Array length : size_t

2013-09-19 Thread Namespace
On Wednesday, 18 September 2013 at 22:20:45 UTC, H. S. Teoh wrote: On Wed, Sep 18, 2013 at 10:46:18PM +0200, Namespace wrote: D's Array length is currently of type size_t, which means on 32 bit it's an uint and on 64 bit an ulong. This is difficult: What if I want to give the le

Array length : size_t

2013-09-18 Thread Namespace
D's Array length is currently of type size_t, which means on 32 bit it's an uint and on 64 bit an ulong. This is difficult: What if I want to give the length of an array as parameter to some C functions which accepts only an int? What is the right/safe way to do this? A cast? Or is there someth

Re: surrounded type modifier

2013-09-18 Thread Namespace
On Wednesday, 18 September 2013 at 14:17:04 UTC, Maxim Fomin wrote: On Wednesday, 18 September 2013 at 13:23:10 UTC, Namespace wrote: Code: const { /// [1] int a = 3; } void main() { const { /// [2] int b = 4; } } Why is [1] allowed, but not

Re: surrounded type modifier

2013-09-18 Thread Namespace
On Wednesday, 18 September 2013 at 13:42:37 UTC, bearophile wrote: Namespace: Code: const { /// [1] int a = 3; } void main() { const { /// [2] int b = 4; } } Why is [1] allowed, but not [2]? Think about what this does: void main

Re: surrounded type modifier

2013-09-18 Thread Namespace
Same thing with debug: { // scope code } debug { // debug code }

surrounded type modifier

2013-09-18 Thread Namespace
Code: const { /// [1] int a = 3; } void main() { const { /// [2] int b = 4; } } Why is [1] allowed, but not [2]?

Re: How to compile this template with short type?

2013-09-17 Thread Namespace
On Tuesday, 17 September 2013 at 07:58:40 UTC, mrd wrote: [code] Unsigned!T encodeZigZag( T )( inout T v ) pure if( isSigned!( T ) ) { return v > 0 ? v * 2 : -v * 2 - 1; } unittest { assert( encodeZigZag!long( 2147483647 ) == 4294967294 );

Re: ref + operator overloading question

2013-09-16 Thread Namespace
On Monday, 16 September 2013 at 21:01:48 UTC, Aleksey wrote: On Monday, 16 September 2013 at 20:53:18 UTC, Namespace wrote: On Monday, 16 September 2013 at 20:43:01 UTC, Aleksey wrote: I get strange type errors in the following code, and I don't understand why =( Could anybody help? str

Re: User defined attributes use

2013-09-16 Thread Namespace
D is not only about arrays. It's a big plus. ;) [1] Obviously, not a practical short term option for the existing D2 language. That's probably clear from the context, and the question was meant to be rhetorical -- but it could actually be done and would make sense; it's just not

Re: ref + operator overloading question

2013-09-16 Thread Namespace
On Monday, 16 September 2013 at 20:43:01 UTC, Aleksey wrote: I get strange type errors in the following code, and I don't understand why =( Could anybody help? struct I { int i; I opBinary(string op)(ref I that) if (op == "+") { return I(i + that.i); } } void m

Re: User defined attributes use

2013-09-16 Thread Namespace
On Monday, 16 September 2013 at 21:11:00 UTC, Artur Skawina wrote: On 09/16/13 22:52, H. S. Teoh wrote: On Mon, Sep 16, 2013 at 10:38:58PM +0200, Namespace wrote: D is not only about arrays. It's a big plus. ;) [1] Obviously, not a practical short term option for the existing D2 lan

Re: User defined attributes use

2013-09-16 Thread Namespace
On Monday, 16 September 2013 at 20:09:53 UTC, Adam D. Ruppe wrote: On Monday, 16 September 2013 at 19:58:51 UTC, Namespace wrote: Why should anyone switch to D if it is nothing else as a new C++? It's worth pointing out that the library AAs proposed here would still have the same synt

Re: User defined attributes use

2013-09-16 Thread Namespace
On Monday, 16 September 2013 at 20:15:26 UTC, Namespace wrote: On Monday, 16 September 2013 at 20:09:53 UTC, Adam D. Ruppe wrote: On Monday, 16 September 2013 at 19:58:51 UTC, Namespace wrote: Why should anyone switch to D if it is nothing else as a new C++? It's worth pointing out tha

Re: User defined attributes use

2013-09-16 Thread Namespace
On Monday, 16 September 2013 at 19:21:47 UTC, H. S. Teoh wrote: On Mon, Sep 16, 2013 at 08:56:17PM +0200, Namespace wrote: [...] I hate this NotNull struct hack. It is the same crap as the current scope solution. BTW: I'm curious which built-in feature will be removed next, may

<    1   2   3   4   5   6   7   8   9   10   >