Re: inout question

2018-02-12 Thread lobo via Digitalmars-d-learn
On Monday, 12 February 2018 at 05:37:23 UTC, ketmar wrote: Norm wrote: Hi, I'm new to D so can someone explain to me what is happening here? void func(const char* s, char** e) { import core.stdc.stdlib; auto result = strtod(s, e); } Error: function core.stdc.stdlib.strtod

Re: assert and enforce both compiled out with -release

2018-01-27 Thread lobo via Digitalmars-d-learn
On Saturday, 27 January 2018 at 22:53:37 UTC, Ali Çehreli wrote: On 01/27/2018 10:33 AM, kdevel wrote: I suggest the deletion of the sentence "Use assert in contracts." Done. Ali Wait, no this isn't right, is it? Enforce should not be used in contracts so the "Use assert in contracts"

Re: How to imporve D-translation of these Python list comprehensions ?

2018-01-15 Thread lobo via Digitalmars-d-learn
On Monday, 15 January 2018 at 19:05:52 UTC, xenon325 wrote: A workmate has recently shown this piece of code to show how nice Python is (we are mostly C and growing C++ shop): [...] Well if that is what they can do in Python I'd hate to see their C++! They have done a great job making

Re: Having "in" for arrays

2017-11-22 Thread lobo via Digitalmars-d-learn
On Wednesday, 22 November 2017 at 09:36:43 UTC, Dukc wrote: On Wednesday, 22 November 2017 at 08:03:50 UTC, Fra Mecca wrote: void main() { auto v = ["r", "i", "o"]; assert ("r" in v); } Also note that even if it wereimplemented, you search for 'r' instead of "r". "r" is a

Re: ESR on post-C landscape

2017-11-13 Thread lobo via Digitalmars-d-learn
On Tuesday, 14 November 2017 at 04:31:43 UTC, Laeeth Isharc wrote: He mentions D, a bit dismissively. http://esr.ibiblio.org/?p=7724=1#comment-1912717 "[snip]...Then came the day we discovered that a person we incautiously gave commit privileges to had fucked up the games’s AI core. It

Re: Generating DDOX documentation

2017-10-22 Thread lobo via Digitalmars-d-learn
On Friday, 20 October 2017 at 10:47:57 UTC, Andrew Edwards wrote: Given a documented source file (eg. process.d), I can generate the DDOC version of the documentation with the -D switch of DMD as such: $ dmd -Dfprocess.html process.d What do I modify on that line to get the DDOX version

Re: Range tee()?

2017-10-16 Thread lobo via Digitalmars-d-learn
On Monday, 16 October 2017 at 07:28:03 UTC, Nick Sabalausky (Abscissa) wrote: Does Phobos have a way to "tee" a range? For example, suppose you had something like this: [...] https://dlang.org/phobos/std_range.html#tee ?

Re: Adding empty static this() causes exception

2017-09-12 Thread lobo via Digitalmars-d-learn
On Tuesday, 12 September 2017 at 19:59:52 UTC, Joseph wrote: On Tuesday, 12 September 2017 at 10:08:11 UTC, Moritz Maxeiner wrote: [...] The compiler shouldn't arbitrarily force one to make arbitrary decisions that waste time and money. My solution was to turn those static this's in to

Re: Bug in D!!!

2017-08-30 Thread lobo via Digitalmars-d-learn
On Wednesday, 30 August 2017 at 20:47:12 UTC, EntangledQuanta wrote: This is quite surprising! public struct S(T) { T s; } interface I { void Go(T)(S!T s); static final I New() { return new C(); } } abstract class A : I {

Re: rename file, execute os, etc at compile time

2017-08-07 Thread lobo via Digitalmars-d-learn
On Monday, 7 August 2017 at 00:07:26 UTC, Johnson Jones wrote: On Sunday, 6 August 2017 at 23:11:56 UTC, Nicholas Wilson wrote: On Sunday, 6 August 2017 at 19:56:06 UTC, Johnson Jones wrote: [...] It is deliberately not possible. reproducible builds security ect. have a look at dubs

Re: Getting usages of template

2016-11-17 Thread lobo via Digitalmars-d-learn
On Thursday, 17 November 2016 at 09:40:45 UTC, Carlin St Pierre wrote: Is it possible to get the list of usages of a template during compile time? For example: class Foo { void bar(T)(T t) { } } void main() { Foo foo = new Foo; foo.bar(1); // int

Re: not callable error

2016-11-04 Thread lobo via Digitalmars-d-learn
On Friday, 4 November 2016 at 14:37:04 UTC, bluphantom91 wrote: On Friday, 4 November 2016 at 02:59:49 UTC, Paul Backus wrote: On Friday, 4 November 2016 at 02:28:17 UTC, bluphantom91 wrote: Hello, I am trying to finish up a group project but I am running into a small problem. I keep getting

Re: How to do "inheritance" in D structs

2016-10-11 Thread lobo via Digitalmars-d-learn
On Wednesday, 12 October 2016 at 02:18:47 UTC, TheFlyingFiddle wrote: On Wednesday, 12 October 2016 at 01:22:04 UTC, lobo wrote: Hi, I'm coming from C++ and wondered if the pattern below has an equivalent in D using structs. I could just use classes and leave it up to the caller to use

How to do "inheritance" in D structs

2016-10-11 Thread lobo via Digitalmars-d-learn
Hi, I'm coming from C++ and wondered if the pattern below has an equivalent in D using structs. I could just use classes and leave it up to the caller to use scoped! as well but I'm not sure how that will play out when others start using my lib. Thanks, lobo module A; class Base1 {

Re: Classes new'd inside for loop are all the same instance?

2016-09-08 Thread lobo via Digitalmars-d-learn
On Thursday, 8 September 2016 at 12:36:29 UTC, drug wrote: 08.09.2016 15:24, lobo пишет: [...] is address of the variable c, that is allocated on the stack and has the same address on every iteration cast(void*)c return the value of variable c that is address of a class instance and is

Re: Classes new'd inside for loop are all the same instance?

2016-09-08 Thread lobo via Digitalmars-d-learn
On Thursday, 8 September 2016 at 12:28:55 UTC, Meta wrote: On Thursday, 8 September 2016 at 12:24:48 UTC, lobo wrote: [...] I don't have time to explain at the moment, but change the `` to `cast(void*)c` and you will see what you expect. I will post an explanation soon. Thanks for the

Classes new'd inside for loop are all the same instance?

2016-09-08 Thread lobo via Digitalmars-d-learn
I am confused, which is normal, but I'd appreciate some help :-) If I create N classes in a for loop they are all the same instance. I would expect each to be a unique instance of the class. See the code below --- class C {} void main() { import std.stdio; auto c1 = new C();

Re: DUB: can I fully control the output file name?

2016-08-09 Thread lobo via Digitalmars-d-learn
On Wednesday, 10 August 2016 at 00:27:44 UTC, lobo wrote: On Tuesday, 9 August 2016 at 08:49:43 UTC, timepp wrote: [...] Have you tried "targetName":"tckeyex.wdx" ? To get a different name for 32/64 bit you may require a configuration for each and run $ dub build -cx86 release $ dub build

Re: DUB: can I fully control the output file name?

2016-08-09 Thread lobo via Digitalmars-d-learn
On Tuesday, 9 August 2016 at 08:49:43 UTC, timepp wrote: I'm writing a Total Commander plugin, which has the "wdx" file extension, so I wish to let dub generate xxx.wdx directly but not xxx.dll. How can I write my file to achieve this goal? --- my dub.json: { "name": "tckeyex",

Re: C binding with D function

2016-08-03 Thread lobo via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 15:41:55 UTC, llaine wrote: void foo(string str) { writeln(str); } shouldn't foo be: void foo(char* str) { import std.string; writeln(str.fromStringz); } bye, lobo

Re: Is there a way to "see" source code generated by templates after a compile?

2016-07-18 Thread lobo via Digitalmars-d-learn
On Sunday, 17 July 2016 at 05:57:52 UTC, WhatMeWorry wrote: [snip] Now that I think about, was there even a way to look at c/c++ code after the pre-processor step? Does this do what you want? cl.exe /E gcc -E clang -E clang-cl /E

Re: Probably trivial Linux link problem that I've spent hours on.

2016-07-04 Thread lobo via Digitalmars-d-learn
On Tuesday, 5 July 2016 at 03:32:25 UTC, WhatMeWorry wrote: Just learning Linux. Got my first vibe/dub project which dies at: [...] You need to install sqlite3, or download and build it yourself, to get libsqlite3.a. I don't use Ubuntu so not sure of the package but you will be able to

Re: use of typeof to determine auto type with ndslice examples

2015-12-20 Thread lobo via Digitalmars-d-learn
On Monday, 21 December 2015 at 04:20:16 UTC, Jay Norwood wrote: I pulled down the std.experimental.ndslice examples and am attempting to build some of the examples and understand the types being used. I know don't need all these imports, but it is hard to guess which ones are needed, and the

Re: Pixelbuffer to draw on a surface

2015-11-30 Thread lobo via Digitalmars-d-learn
On Monday, 30 November 2015 at 08:37:04 UTC, TheDGuy wrote: Hi, is there any possibility, to draw with a pixelbuffer to a surface (for example with GTKD) and to update it every few milliseconds? Are any of these suitable for your needs? https://github.com/DerelictOrg/DerelictSDL2

Re: Binding to GSL library

2015-11-25 Thread lobo via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 16:11:56 UTC, Radek wrote: Hi, I'm making a trying to bind a gsl library http://www.gnu.org/software/gsl/ so far it was working but when i started binding complex numbers some functions won't work, like trigonometric functions - called they return null. in

Re: Looking for a language to hang my hat on.

2015-11-16 Thread lobo via Digitalmars-d-learn
On Monday, 16 November 2015 at 22:39:17 UTC, Dan wrote: I am a very new c++ programmer, having just learned the language this year. A few months ago I completed a course on Coursera that dealt with the security aspect of c (which I don't know, but it is similar enough):

Re: why does this error out?

2015-11-11 Thread lobo via Digitalmars-d-learn
On Thursday, 12 November 2015 at 02:36:23 UTC, lobo wrote: On Tuesday, 10 November 2015 at 14:25:19 UTC, steven kladitis wrote: On Tuesday, 10 November 2015 at 05:14:29 UTC, lobo wrote: [...] with dmd 2.069 I always get --> [1 and then the error no matter what I canhe that line to. Hmm,

Re: why does this error out?

2015-11-11 Thread lobo via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 14:25:19 UTC, steven kladitis wrote: On Tuesday, 10 November 2015 at 05:14:29 UTC, lobo wrote: On Tuesday, 10 November 2015 at 04:34:22 UTC, Cauterite wrote: Here's the output I get (DMD v2.068.2): [1, 3, 10, 12, 21, 30, 100, 102, 111, 120, 201, 210]

Re: why does this error out?

2015-11-09 Thread lobo via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 04:34:22 UTC, Cauterite wrote: Here's the output I get (DMD v2.068.2): [1, 3, 10, 12, 21, 30, 100, 102, 111, 120, 201, 210] core.exception.AssertError@std\range\package.d(4603): Assertion failure iota.front() is complaining the range is empty from this line.

Re: very very thank you

2015-10-29 Thread lobo via Digitalmars-d-learn
On Thursday, 29 October 2015 at 06:13:17 UTC, guodemone wrote: 衷心的谢谢你,(very veryvery thank you in english) You're welcome, hope it helps :)

Re: Can you give me your files[kickstart32.s kmain.d linker32.ld makefile]?

2015-10-28 Thread lobo via Digitalmars-d-learn
On Wednesday, 28 October 2015 at 11:01:14 UTC, guodemone wrote: My english is poor. My code to build is wrong.so need make some improvements. I would like to refer to your 32-bit code, make some improvements. My Email: 704975...@qq.com very very thank you. I've uploaded a dummy kernel

Re: asm+D build bootloader

2015-10-27 Thread lobo via Digitalmars-d-learn
On Tuesday, 27 October 2015 at 12:13:13 UTC, guodemone wrote: sorry,My english is poot. file asm.h [...] Can ldc work with C header files? I don't think it can but I could be wrong. Here's how I build my 32-bit bootloader and link with my kernel main (you will have to replace names

Re: Casting away immutability

2015-09-01 Thread lobo via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 04:04:54 UTC, Sergei Degtiarev wrote: On Wednesday, 2 September 2015 at 02:50:30 UTC, Jonathan M Davis wrote: is undefined behavior. So, don't do it. I don't. Actually, I'm looking for opposite - to protect data, like it is a class with two methods, returning

Re: Why approxEqual not working for integers in dmd 2068-b2

2015-07-28 Thread lobo via Digitalmars-d-learn
On Tuesday, 28 July 2015 at 07:42:32 UTC, Daniel Kozák wrote: Even if this will be considered as non compiler bug, it is a regression on phobos side and should be addressed. So please fill a bug report on http://issues.dlang.org done, thanks https://issues.dlang.org/show_bug.cgi?id=14842

Why approxEqual not working for integers in dmd 2068-b2

2015-07-27 Thread lobo via Digitalmars-d-learn
Hi all, I have a bunch of unittests for template code taking any numeric type. Because I'm lazy I just use the approxEqual for both floating point and integer comparisons in these tests. In DMD 2067.1 everthing compiled OK but in 2068-b2 I get the errors shown at the end of this post for

optimizing struct/class members

2015-07-06 Thread lobo via Digitalmars-d-learn
Hi, In C++ it's important to layout struct/class members correctly for performance reasons. Is the same true in D? Thanks, lobo

Re: optimizing struct/class members

2015-07-06 Thread lobo via Digitalmars-d-learn
On Tuesday, 7 July 2015 at 00:23:38 UTC, John Colvin wrote: On Monday, 6 July 2015 at 23:24:00 UTC, lobo wrote: Hi, In C++ it's important to layout struct/class members correctly for performance reasons. Is the same true in D? Thanks, lobo Short answer: yes. thanks, lobo

Re: Necessity of D Library (and/or Core Library)

2015-05-23 Thread lobo via Digitalmars-d-learn
On Saturday, 23 May 2015 at 06:35:50 UTC, Anthony Monterrosa wrote: Does D require the standard library to function? Or to be more direct, does D as a language need its library, or core library, to function correctly? I have become very interested in how programming languages do

Re: mixin template question

2015-04-11 Thread lobo via Digitalmars-d-learn
On Sunday, 12 April 2015 at 03:51:03 UTC, Paul D Anderson wrote: I don't understand why the following code compiles and runs without an error: import std.stdio; mixin template ABC(){ int abc() { return 3; } } mixin ABC; int abc() { return 4; } void main() { writefln(abc() = %s, abc());

Re: std.logger sharedLog usage

2015-03-29 Thread lobo via Digitalmars-d-learn
On Sunday, 29 March 2015 at 12:37:23 UTC, Robert burner Schadek wrote: On Sunday, 29 March 2015 at 01:36:24 UTC, lobo wrote: Hi, I'm trying to use std.experimental.logger and I'd like the logf(), tracef() style functions to log to a file and stdout. (note: I can use sharedLog.logf(),

Re: Passing myself, a struct, as a C callback context

2015-03-29 Thread lobo via Digitalmars-d-learn
On Monday, 30 March 2015 at 02:53:36 UTC, Paul O'Neil wrote: I'm registering a callback with some C code. The simplified story is here, but the actual code is on GitHub [1] at the end if you care. The call looks something like this. void register(void(*fp)(void*), void* context); I have a

std.logger sharedLog usage

2015-03-28 Thread lobo via Digitalmars-d-learn
Hi, I'm trying to use std.experimental.logger and I'd like the logf(), tracef() style functions to log to a file and stdout. (note: I can use sharedLog.logf(), sharedLog.tracef(), but I prefer just logf()) So I did this: shared static this() { auto ml = new MultiLogger();

Re: std.logger sharedLog usage

2015-03-28 Thread lobo via Digitalmars-d-learn
On Sunday, 29 March 2015 at 01:36:24 UTC, lobo wrote: Hi, I'm trying to use std.experimental.logger and I'd like the logf(), tracef() style functions to log to a file and stdout. (note: I can use sharedLog.logf(), sharedLog.tracef(), but I prefer just logf()) So I did this: shared static