Re: Compiler gets confused with ambiguity when `int` matches both `real` and `float`.

2017-12-23 Thread Muld via Digitalmars-d-learn
On Saturday, 23 December 2017 at 07:25:34 UTC, IM wrote: The following expression: import std.math : sqrt; sqrt(400); produces the following compiler error: std.math.sqrt called with argument types (int) matches both: /usr/include/dmd/phobos/std/math.d(1592,7): std.math.sqrt(float x)

Re: Finding equivalent of C++ feature in D documentation.

2017-12-23 Thread Seb via Digitalmars-d-learn
On Saturday, 23 December 2017 at 15:45:33 UTC, Mike Franklin wrote: On Saturday, 23 December 2017 at 15:04:30 UTC, kerdemdemir wrote: Is there any better way for me to search C/C++ equivalent features? As a humble suggestion would it make sense to make a table with feature names and

DUB describe error in Eclipse

2017-12-23 Thread Adil via Digitalmars-d-learn
Eclipse: Version: Neon.3 Release (4.6.3) Platform: Ubuntu 16.04 I have a running version of dub and dmd that works from the command line. But does not work from Eclipse (DDT). When i CTRL+Click on a function or module it should take me to the source, instead if gives the following error:

What does scope do as storage class?

2017-12-23 Thread Marc via Digitalmars-d-learn
for example: scope struct S { int x; } What does scope do here?

Re: Finding equivalent of C++ feature in D documentation.

2017-12-23 Thread kerdemdemir via Digitalmars-d-learn
On Saturday, 23 December 2017 at 15:58:27 UTC, Seb wrote: On Saturday, 23 December 2017 at 15:45:33 UTC, Mike Franklin wrote: On Saturday, 23 December 2017 at 15:04:30 UTC, kerdemdemir wrote: Is there any better way for me to search C/C++ equivalent features? As a humble suggestion would it

Re: Does LDC support profiling at all?

2017-12-23 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 23 December 2017 at 12:23:33 UTC, Johan Engelen wrote: Fine grained PGO profiling: -fprofile-instr-generate http://johanengelen.github.io/ldc/2016/07/15/Profile-Guided-Optimization-with-LDC.html Function entry/exit profiling: -finstrument-functions

Re: Finding equivalent of C++ feature in D documentation.

2017-12-23 Thread Mike Franklin via Digitalmars-d-learn
On Saturday, 23 December 2017 at 15:04:30 UTC, kerdemdemir wrote: Is there any better way for me to search C/C++ equivalent features? As a humble suggestion would it make sense to make a table with feature names and corresponding name of the same feature in other languages ? Try this:

Re: One liner for creating an array filled by a factory method

2017-12-23 Thread kerdemdemir via Digitalmars-d-learn
On Friday, 22 December 2017 at 23:33:55 UTC, Mengu wrote: On Thursday, 21 December 2017 at 21:11:58 UTC, Steven Schveighoffer wrote: On 12/21/17 4:00 PM, kerdemdemir wrote: I have a case like : http://rextester.com/NFS28102 I have a factory method, I am creating some instances given some

Re: Does LDC support profiling at all?

2017-12-23 Thread Johan Engelen via Digitalmars-d-learn
On Friday, 22 December 2017 at 09:52:26 UTC, Chris Katko wrote: DMD can use -profile and -profile=gc. But I tried for HOURS to find the equivalent for LDC and came up with only profile-guided optimization--which I don't believe I want. Yet, if we can get PGO... where's the PROFILE itself it's

Re: One liner for creating an array filled by a factory method

2017-12-23 Thread Mengu via Digitalmars-d-learn
On Saturday, 23 December 2017 at 08:57:18 UTC, kerdemdemir wrote: On Friday, 22 December 2017 at 23:33:55 UTC, Mengu wrote: On Thursday, 21 December 2017 at 21:11:58 UTC, Steven Schveighoffer wrote: On 12/21/17 4:00 PM, kerdemdemir wrote: I have a case like : http://rextester.com/NFS28102 I

[DMD or LDC] Is it possible to get the GC to print to stdout when it collects?

2017-12-23 Thread Chris Katko via Digitalmars-d-learn
I'm having a strange stuttering issue in my game prototype. I use GC allocations wildly for the heck of it at the moment--with eventual plans to remove them. However, I'm not positive it's the GC that's the problem, and if so, I want to know exact lengths of time and frequency. Currently,

Re: [DMD or LDC] Is it possible to get the GC to print to stdout when it collects?

2017-12-23 Thread rikki cattermole via Digitalmars-d-learn
On 23/12/2017 11:06 AM, Chris Katko wrote: I'm having a strange stuttering issue in my game prototype. I use GC allocations wildly for the heck of it at the moment--with eventual plans to remove them. However, I'm not positive it's the GC that's the problem, and if so, I want to know exact

Re: DerelictGL3 glGenBuffers segmentation fault.

2017-12-23 Thread Kevin via Digitalmars-d-learn
On Sunday, 24 December 2017 at 01:42:58 UTC, Mike Parker wrote: Need more info than this. Some code that reproduces the issue would be helpful. Also, what do you mean by "import my library"? I making a simple static library. For I can go through Opengl tutorials again. Need to refresh my

Re: What does scope do as storage class?

2017-12-23 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, December 23, 2017 21:05:25 Marc via Digitalmars-d-learn wrote: > for example: > > scope struct S { >int x; > } > > What does scope do here? Absolutely nothing. https://stackoverflow.com/questions/47240714/d-pure-classes-and-structs - Jonathan M Davis

indexing stuff during compile time

2017-12-23 Thread Eric via Digitalmars-d-learn
I am trying to build a string->int dictionary at compile time. The ints are unique and must not be greater than the number of unique strings. So, they are sequential for each string that is not yet indexed. Example: size_t idx1 = nameToIndex!"blah"; // 0 size_t idx2 = nameToIndex!"blah2"; //

DerelictGL3 glGenBuffers segmentation fault.

2017-12-23 Thread Kevin via Digitalmars-d-learn
I'm working a library with DerelictGL3. using branch 2.0 import derelict.opengl; import std.stdio : writeln; struct VertexBuffer { GLuint vbo; GLsizei count; this(GLsizei n) { writeln("creating vbo"); glGenBuffers(n, ); writeln("created vbo");

Re: Why does calling a struct constructor generate linker errors when using Better C?

2017-12-23 Thread Stijn via Digitalmars-d-learn
On Sunday, 24 December 2017 at 01:29:56 UTC, rikki cattermole wrote: Although maybe you ought to start out with regular D. -betterC is really there for those who want D but can't have druntime. They should already know D pretty well. I'm using -betterC on purpose, doing bare-metal

Re: DerelictGL3 glGenBuffers segmentation fault.

2017-12-23 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 24 December 2017 at 00:58:25 UTC, Kevin wrote: When I import my library into my program. glGenBuffers segmentation fault. When I copy VertexBuffer into main code. It works fine. Why am I getting segmentation fault from library ? Need more info than this. Some code that

Re: Does LDC support profiling at all?

2017-12-23 Thread Chris Katko via Digitalmars-d-learn
On Saturday, 23 December 2017 at 12:23:33 UTC, Johan Engelen wrote: On Friday, 22 December 2017 at 09:52:26 UTC, Chris Katko wrote: DMD can use -profile and -profile=gc. But I tried for HOURS to find the equivalent for LDC and came up with only profile-guided optimization--which I don't

Re: Compile to non-OS binary

2017-12-23 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 24 December 2017 at 03:15:58 UTC, Amorphorious wrote: In fact, it would be very helpful to have switches that disable the various "features" of D that I will not use rather than having to do any self compilation. The way I did it was create a custom runtime only including the

Re: What does scope do as storage class?

2017-12-23 Thread Nemanja Boric via Digitalmars-d-learn
On Saturday, 23 December 2017 at 21:20:13 UTC, Jonathan M Davis wrote: On Saturday, December 23, 2017 21:05:25 Marc via Digitalmars-d-learn wrote: for example: scope struct S { int x; } What does scope do here? Absolutely nothing.

Re: GC in D and synadard library.

2017-12-23 Thread Chris Katko via Digitalmars-d-learn
On Thursday, 21 December 2017 at 10:49:46 UTC, Dan Partelly wrote: I started to look into D very recently. I would like to know the following, if you guys are so nice to help me: 1. What is the performance of D's GC, what trade-offs where done in design , and if a in-deep primer on

Re: DerelictGL3 glGenBuffers segmentation fault.

2017-12-23 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 24 December 2017 at 03:00:16 UTC, Kevin wrote: On Sunday, 24 December 2017 at 01:42:58 UTC, Mike Parker wrote: I've found the problem. But first... I making a simple static library. I don't see a static library anywhere. You weren't "importing a static library", something which

Re: DerelictGL3 glGenBuffers segmentation fault.

2017-12-23 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 24 December 2017 at 05:23:12 UTC, Mike Parker wrote: If you are going to use glFreeFuncs like this, you can't import opengl that way. As per the DerelictGL3 documentation [1], the simplest way to make this work is to implement a module that publicly imports derelict.opengl and

Why does calling a struct constructor generate linker errors when using Better C?

2017-12-23 Thread Stijn via Digitalmars-d-learn
https://dlang.org/spec/betterc.html doesn't mention struct constructors not working, but I'm getting linker errors when trying to call a struct constructor. Consider the following program betterc.d struct foo { } extern(C) void main() { auto bar = new foo(); }

Re: Why does calling a struct constructor generate linker errors when using Better C?

2017-12-23 Thread rikki cattermole via Digitalmars-d-learn
On 24/12/2017 1:20 AM, Stijn wrote: https://dlang.org/spec/betterc.html doesn't mention struct constructors not working, but I'm getting linker errors when trying to call a struct constructor. Consider the following program betterc.d     struct foo     {     }     extern(C) void main()

Compile to non-OS binary

2017-12-23 Thread Amorphorious via Digitalmars-d-learn
I would like to compile D for the different supported architectures only without and OS, C lib, D lib, or GC code. For example, as a boot loader or even bios binary. In fact, it would be very helpful to have switches that disable the various "features" of D that I will not use rather than

Re: Compile to non-OS binary

2017-12-23 Thread Amorphorious via Digitalmars-d-learn
Premature send(tabs?!?! ;/) void main() { version(BIOS) { import iBIOS; BIOSOut("Hello World"); } else { writeln("Hello World"); } } When compiled appropriately will create a bootable executable that displays the string. Else will create an OS specific

Re: GC in D and synadard library.

2017-12-23 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, December 21, 2017 12:00:17 Mike Franklin via Digitalmars-d- learn wrote: > I'm not a big user of the standard library, but I believe most > features of the standard library require the GC. Actually, relatively little in Phobos explicitly uses the GC. There are some things that

Re: Why does calling a struct constructor generate linker errors when using Better C?

2017-12-23 Thread rikki cattermole via Digitalmars-d-learn
On 24/12/2017 1:25 AM, Stijn wrote: On Sunday, 24 December 2017 at 01:21:53 UTC, rikki cattermole wrote: On 24/12/2017 1:20 AM, Stijn wrote: [...] new uses GC. It has nothing to do with structs. Oh I see, simply removing 'new' solves the problem. I've a C# background, so I hadn't thought

Re: Why does calling a struct constructor generate linker errors when using Better C?

2017-12-23 Thread Stijn via Digitalmars-d-learn
On Sunday, 24 December 2017 at 01:21:53 UTC, rikki cattermole wrote: On 24/12/2017 1:20 AM, Stijn wrote: [...] new uses GC. It has nothing to do with structs. Oh I see, simply removing 'new' solves the problem. I've a C# background, so I hadn't thought of doing that. Thanks!

Re: WARN on implicit super?

2017-12-23 Thread Chris Katko via Digitalmars-d-learn
On Thursday, 21 December 2017 at 10:13:47 UTC, bauss wrote: On Thursday, 21 December 2017 at 06:47:25 UTC, Ali Çehreli wrote: [...] This is what I would believe __IS__ and __SHOULD__ be the default behavior too, because that's how it generally is in other languages. It doesn't make much

Finding equivalent of C++ feature in D documentation.

2017-12-23 Thread kerdemdemir via Digitalmars-d-learn
I needed to find equivalent of member initialization list in D. After searching ~10 minutes I found D has very elegant solution (https://dlang.org/spec/class.html#field-init) after reading through whole constructor page. My question is not technical this time I have my solution. But I think