Re: My DMD ~master build gives linker error and IDK why

2017-06-07 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 7 June 2017 at 09:50:41 UTC, Basile B. wrote: bla bla bla Actually it's this code: void main(string[] args) { import std.stdio; import std.compiler; writeln(vendor); } that gives the error. I suspect a regression.

My DMD ~master build gives linker error and IDK why

2017-06-07 Thread Basile B. via Digitalmars-d-learn
This is my script: HOST_DMD=dmd MODEL=64 cd dmd make -fposix.mak MODEL=64 clean make -fposix.mak ENABLE_RELEASE=1 MODEL=64 DMD=../dmd/src/dmd -j 5 cd ../druntime make -fposix.mak MODEL=64 clean make -fposix.mak MODEL=64 DMD=../dmd/src/dmd -j 5 cd ../phobos make -fposix.mak MODEL=64 clean

Re: D and GDB

2017-06-04 Thread Basile B. via Digitalmars-d-learn
On Monday, 5 June 2017 at 01:07:51 UTC, H. S. Teoh wrote: It can't be any more trivial than just running ddemangle, which is found in the dlang/tools repo on github. Trivial i don't know but i had the feeling that the OP complained about the stack trace not being readable although all the

Re: D and GDB

2017-06-04 Thread Basile B. via Digitalmars-d-learn
On Sunday, 4 June 2017 at 18:13:41 UTC, Russel Winder wrote: Sadly even using the correct command, I am not getting any data that helps infer what the is going on. :-( #0  0x7fffc770 in ?? () #1  0x77bb3d80 in dvb_scan_transponder () from

Re: How to Compare 2 objects of the same class

2017-06-03 Thread Basile B. via Digitalmars-d-learn
On Saturday, 3 June 2017 at 20:02:13 UTC, Mark wrote: On Saturday, 3 June 2017 at 19:57:47 UTC, Mark wrote: Hello again. I'm designing a template version of a BST. Because of this, I want to be able to compare if two objects of the same class type are references to the same anonymous class

Re: Strange expression found in std.variant

2017-06-03 Thread Basile B. via Digitalmars-d-learn
On Saturday, 3 June 2017 at 16:22:33 UTC, Francis Nixon wrote: When looking at std.variant I found the following line: return q{ static if (allowed!%1$s && T.allowed!%1$s) if (convertsTo!%1$s && other.convertsTo!%1$s) return VariantN(get!%1$s %2$s other.get!%1$s);

Re: Lazy evaluation and @nogc code

2017-06-03 Thread Basile B. via Digitalmars-d-learn
On Saturday, 3 June 2017 at 14:34:41 UTC, Nick Vitsas wrote: In any case, do you think that `scope` should allow for such code to compile? Since you can get the desired result using the verbose version, I think you should also be able to using the `lazy` construct. I think so. There's even a

Re: [Starting with D] d2html.d issues an error

2017-05-25 Thread Basile B. via Digitalmars-d-learn
On Thursday, 25 May 2017 at 15:02:33 UTC, Oleksii wrote: Hi everyone, Could you please help me? I'm get the following error from all.sh: $ /e/D/dmd2/windows/bin/shell.exe all.sh shell 1.05 ..\..\windows\bin\dmd d2html d2html.d(18): Error: module stream is in file 'std\stream.d'

Re: Searching strings with indexOf vs countUntil

2017-05-25 Thread Basile B. via Digitalmars-d-learn
On Thursday, 25 May 2017 at 11:55:21 UTC, Kagamin wrote: I would guess indexOf returns a value suitable for indexing, therefore it counts code units, while countUntil counts range elements - code points in case of a string. Also number of code points is not suitable for indexing an utf8

Re: get vtable size

2017-05-08 Thread Basile B. via Digitalmars-d-learn
On Sunday, 7 May 2017 at 04:01:43 UTC, Mike B Johnson wrote: how many elements(virtual functions) are in the __vptr? You don't need the size. The index you get with __traits(virtualIndex) is always valid. (https://dlang.org/spec/traits.html#getVirtualIndex) However as an exercise you can

Re: Porting Java code to D that uses << and >>> operators

2017-05-01 Thread Basile B. via Digitalmars-d-learn
On Monday, 1 May 2017 at 15:45:00 UTC, bachmeier wrote: I'm porting a small piece of Java code into D, but I've run into this: int y1 = ((x12 & MASK12) << 22) + (x12 >>> 9) + ((x13 & MASK13) << 7) + (x13 >>> 24); I have a basic understanding of those operators in both languages, but I

Re: Using the same name for diffrent entities

2017-05-01 Thread Basile B. via Digitalmars-d-learn
On Monday, 1 May 2017 at 14:01:19 UTC, Noy wrote: Hello, Is it possible to use the same name for different entities? For example calling a variable and a class\function by the same name. It only works with functions that take different parameters or with templated functions that have

Re: How to overload member function pointer and a regualr member function

2017-04-26 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 25 April 2017 at 18:58:58 UTC, Ali Çehreli wrote: On 04/25/2017 11:54 AM, Ali Çehreli wrote: My analysis is wrong because that writefln() is for the bar(float) overload but I still think what you want is achieved. Ali No it's ok, it works. The additional indirection is well

Re: How to overload member function pointer and a regualr member function

2017-04-25 Thread Basile B. via Digitalmars-d-learn
On Monday, 24 April 2017 at 16:46:21 UTC, ParticlePeter wrote: I would like to have this kind of struct: struct Foo { private int i; void function( int i, float f ) bar; // will be defined at runtime void bar( float f ) { bar( i, f ); } } [...] How else can I get the required

Re: typeof(this) return wrong type

2017-04-22 Thread Basile B. via Digitalmars-d-learn
On Saturday, 22 April 2017 at 11:45:54 UTC, Andrey wrote: On Saturday, 22 April 2017 at 11:36:09 UTC, Stefan Koch wrote: On Saturday, 22 April 2017 at 11:33:22 UTC, Andrey wrote: Hello, I trying to add custom attribute OnClickListener, the problem is that typeof always return BaseView type

Re: hidden passing of __FILE__ and __LINE__ into function

2017-04-17 Thread Basile B. via Digitalmars-d-learn
On Monday, 17 April 2017 at 10:55:30 UTC, Jonathan M Davis wrote: On Monday, April 17, 2017 10:30:35 Basile B. via Digitalmars-d-learn wrote: On Monday, 17 April 2017 at 10:22:47 UTC, Dmitry wrote: void error(string msg, string file = __FILE__, size_t line = __LINE__) { ... } That's what

Re: hidden passing of __FILE__ and __LINE__ into function

2017-04-17 Thread Basile B. via Digitalmars-d-learn
On Monday, 17 April 2017 at 10:22:47 UTC, Dmitry wrote: Hi there. Currently for messages about errors I use code like this: void add(string name, ref Scene scene) { if (name in listOfScenes) { EError(__FILE__, __LINE__, "scene already exists".L,

Re: Command Line Parsing

2017-04-12 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 12 April 2017 at 09:51:34 UTC, Russel Winder wrote: Are Argon https://github.com/markuslaker/Argon or darg https://github. com/jasonwhite/darg getting traction as the default command line handling system for D or are they just peripheral and everyone just uses std.getopt

Re: Forwarding calls to objects of another type

2017-04-10 Thread Basile B. via Digitalmars-d-learn
On Monday, 10 April 2017 at 21:04:10 UTC, Johan Fjeldtvedt wrote: I have a couple of questions related to the following code: https://gist.github.com/Jaffe-/b027287a884fc2e173a65601ec242676 1) This is a very simplified example, but what I'm trying to do here is to call `foo` on each object in

Re: Write file at compile time?

2017-04-02 Thread Basile B. via Digitalmars-d-learn
On Sunday, 2 April 2017 at 19:42:52 UTC, Inquie wrote: I would like to write the output of a manifest constant at compile time to a file instead of console using pragma(msg). Is this possible? No.

Re: delegate with optional parameters

2017-04-02 Thread Basile B. via Digitalmars-d-learn
On Sunday, 2 April 2017 at 20:48:09 UTC, Inquie wrote: On Sunday, 2 April 2017 at 20:02:56 UTC, Basile B. wrote: On Sunday, 2 April 2017 at 19:24:14 UTC, Inquie wrote: is it possible to create a delegate that takes an optional number of parameters and/or return type? T delegate(S...)(S)

Re: delegate with optional parameters

2017-04-02 Thread Basile B. via Digitalmars-d-learn
On Sunday, 2 April 2017 at 19:24:14 UTC, Inquie wrote: is it possible to create a delegate that takes an optional number of parameters and/or return type? T delegate(S...)(S) special_delegate; I guess this is impossible? alias Dg(Return, Params...) = Return delegate(Params); Dg!(int,float,

Re: Error: out of memory

2017-03-18 Thread Basile B. via Digitalmars-d-learn
On Saturday, 18 March 2017 at 20:56:47 UTC, StarGrazer wrote: On Saturday, 18 March 2017 at 20:43:29 UTC, Basile B. wrote: On Saturday, 18 March 2017 at 20:39:20 UTC, StarGrazer wrote: I have some CTFE's and meta programming that cause dmd to run out of memory ;/ I am generating simple

Re: Error: out of memory

2017-03-18 Thread Basile B. via Digitalmars-d-learn
On Saturday, 18 March 2017 at 20:39:20 UTC, StarGrazer wrote: I have some CTFE's and meta programming that cause dmd to run out of memory ;/ I am generating simple classes, but a lot of them. dmd uses about 2GB before it quites. It also only uses about 12% of cpu. I have 16 GB total memory

Re: Get most D type from type

2017-03-18 Thread Basile B. via Digitalmars-d-learn
On Saturday, 18 March 2017 at 15:30:27 UTC, Hussien wrote: On Saturday, 18 March 2017 at 15:16:35 UTC, Basile B. wrote: On Saturday, 18 March 2017 at 13:30:22 UTC, Hussien wrote: On Saturday, 18 March 2017 at 13:16:49 UTC, Adam D. Ruppe wrote: On Saturday, 18 March 2017 at 13:06:56 UTC,

Re: Get most D type from type

2017-03-18 Thread Basile B. via Digitalmars-d-learn
On Saturday, 18 March 2017 at 13:30:22 UTC, Hussien wrote: On Saturday, 18 March 2017 at 13:16:49 UTC, Adam D. Ruppe wrote: On Saturday, 18 March 2017 at 13:06:56 UTC, Hussien wrote: So you are telling me there is no way to do this easily? What are you actually trying to do? Glad you

Re: Building custom library package with dub

2017-03-18 Thread Basile B. via Digitalmars-d-learn
On Saturday, 18 March 2017 at 11:29:43 UTC, alex1974 wrote: I want to build a custom library with useful extensions to phobos. They should be named like: extensions.regex extensions.path extensions.files ... Some libraries, like extensions.files contain several files (e.g files.d,

Re: code folding

2017-03-18 Thread Basile B. via Digitalmars-d-learn
On Monday, 13 March 2017 at 17:29:41 UTC, Inquie wrote: Does D have any nice way to specify a block for cold folding? I have a very large set of structs and I'd like to be able to code fold them all at once and together. I have been using static if(true) { ... junk } but the static if

Re: scope(~this)

2017-03-16 Thread Basile B. via Digitalmars-d-learn
On Thursday, 16 March 2017 at 07:49:19 UTC, Basile B. wrote: On Wednesday, 15 March 2017 at 19:34:32 UTC, Ali Çehreli wrote: On 03/15/2017 03:23 AM, Basile B. wrote: > you can use a mixin template because > they can introduce destructors that are called automatically with the > aggregate

Re: scope(~this)

2017-03-16 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 15 March 2017 at 19:34:32 UTC, Ali Çehreli wrote: On 03/15/2017 03:23 AM, Basile B. wrote: > you can use a mixin template because > they can introduce destructors that are called automatically with the > aggregate destrcutor Wow! Is this specified anywhere or have you come across

Re: scope(~this)

2017-03-15 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 14 March 2017 at 14:35:11 UTC, Inquie wrote: On Tuesday, 14 March 2017 at 05:33:28 UTC, thedeemon wrote: [...] Complexity is in the eye of the beholder. Children think many things are complex when they are not. If a library solution could be created that is as seamless as a

Re: In Expressions

2017-03-05 Thread Basile B. via Digitalmars-d-learn
On Saturday, 4 March 2017 at 19:31:46 UTC, Andrey wrote: On Saturday, 4 March 2017 at 17:57:16 UTC, John Colvin wrote: but to be honest, I would just repeat myself a bit and write if (regionAlign == RegionAlign.top || regionAlign == RegionAlign.bottom) { } That's exactly what I did, just

Re: opApply with Type Inference and Templates?

2017-02-15 Thread Basile B. via Digitalmars-d-learn
On Thursday, 16 February 2017 at 03:20:12 UTC, Jerry wrote: I am trying to do opApply to work when the delegate passed when it is and isn't nogc/nothrow. As soon as you involve a template though, type inference goes out the door. I want to be able to use opApply with templates (to get the auto

Re: Why File.rawRead is @system?

2017-02-07 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 7 February 2017 at 09:21:18 UTC, Kagamin wrote: Can't find a reason why it's not inferred @safe (on linux). Any idea? Uh ? It's safe Just tried import std.stdio; void main(string[] args) @safe { File f; ubyte[] z; z = f.rawRead(z); } And it compiles (DMD

Re: Need help to compile code with traits

2017-02-05 Thread Basile B. via Digitalmars-d-learn
On Sunday, 5 February 2017 at 14:59:04 UTC, Xavier Bigand wrote: Hi, I am trying to create an allocator that don't use the GC, and I have issues for the initialization of member before calling the constructor. Here is my actual code : mixin template NogcAllocator(T) { static T

Re: Can't find the reason of issue: "std.file.FileException@std\file.d(360): path/to/file.conf:"

2017-02-01 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 11:39:46 UTC, Suliman wrote: Full error log: 0x00580A4D in @trusted bool std.file.cenforce!(bool).cenforce(bool, const(char)[], const(wchar)*, immutable(char)[], uint) 0x00412AB6 in @safe void[] std.file.read!(immutable(char)[]).read(immutable(char)[], uint)

Re: Multiple return type or callback function

2017-01-23 Thread Basile B. via Digitalmars-d-learn
On Monday, 23 January 2017 at 15:15:35 UTC, aberba wrote: I'm creating a function to authenticate user login. I want to determine login failure (Boolean) and error message (will be sent to frontend) but D does have multiple return type [...] Yes, MRV can be done with a tuple auto foo() {

Re: Calls `this(this)` extra with delegate stuff in the code

2017-01-21 Thread Basile B. via Digitalmars-d-learn
On Sunday, 22 January 2017 at 03:42:21 UTC, Ali Çehreli wrote: On 01/21/2017 07:22 PM, Basile B. wrote: [...] Wow! Thanks. I know about 'alias this' but this (pun!) is new to me. TIL indeed and WAT (four exclamation marks is right in this case. :o) ) import std.stdio; struct S {

Re: Calls `this(this)` extra with delegate stuff in the code

2017-01-21 Thread Basile B. via Digitalmars-d-learn
On Sunday, 22 January 2017 at 00:31:38 UTC, Ali Çehreli wrote: On 01/21/2017 03:36 PM, Ali Çehreli wrote: > Change the signature and it works without copies: > > this(const(this)) { > // ... > } Ugh... :( It's not a post-blit. Then what is it? Ali This is a __ctor that takes

Re: What do you use to generate documentation?

2017-01-19 Thread Basile B. via Digitalmars-d-learn
On Thursday, 19 January 2017 at 15:20:37 UTC, Suliman wrote: What do dflag: `-c do not link`. Should I pass it during the generation of the docs? dub is append it's automatically, but if I want to generate new docs every rebuild of app what is the reason to use this flag? Oh no 2013 !! I

Re: What do you use to generate documentation?

2017-01-19 Thread Basile B. via Digitalmars-d-learn
On Thursday, 19 January 2017 at 17:06:39 UTC, Nemanja Boric wrote: On Thursday, 19 January 2017 at 16:47:07 UTC, Basile B. wrote: [...] I've submitted few PRs but they never got merged. We're maintaining, unofficially, fork that does compile and it's available at:

Re: What do you use to generate documentation?

2017-01-19 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 13 March 2013 at 09:35:18 UTC, Andrea Fontana wrote: I've tried to build documentation using ddoc format and dmd. dmd -c -D -o- ... Generated documentation looks ugly and without stylesheet. Am I wrong? I expected a phobos-like documentation. So, what do you use to generate

Re: Printing a floats in maximum precision

2017-01-17 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 18 January 2017 at 00:09:42 UTC, Nordlöw wrote: What's the easiest way to print a double in maximum precision? %.6g for floats and %.17g for doubles. This is for example what's used on std.json to get a perfect conversion from string to value. the number is the maximum number

Re: Quine using strings?

2017-01-15 Thread Basile B. via Digitalmars-d-learn
On Sunday, 15 January 2017 at 19:43:22 UTC, Nestor wrote: I was reading some of the examples of writing a quine with D, but apparently the language has evolved and they no longer compiled unchanged. So I tried to program one by myself using strings and std.stdio, but the result seems long

Re: Check of point inside/outside polygon

2017-01-11 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 13:32:00 UTC, Suliman wrote: Ideally I need algorithm that can return bool if one polygon overlapped/intersected by another. But I do not know math. After some googling I found topic on SO[1] about point inside/outside polygon. It's not directly what I need, but as

Re: Mixin in Inline Assembly

2017-01-10 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 11 January 2017 at 00:11:50 UTC, Chris M wrote: On Tuesday, 10 January 2017 at 13:13:17 UTC, Basile B. wrote: On Tuesday, 10 January 2017 at 11:38:43 UTC, Guillaume Piolat wrote: On Tuesday, 10 January 2017 at 10:41:54 UTC, Basile B. wrote: don't forget to flag asm pure

Re: Mixin in Inline Assembly

2017-01-10 Thread Basile B. via Digitalmars-d-learn
On Monday, 9 January 2017 at 02:31:42 UTC, Chris M. wrote: Right now I'm working on a project where I'm implementing a VM in D. I'm on the rotate instructions, and realized I could *almost* abstract the ror and rol instructions with the following function private void rot(string ins)(int

[OT] Anyone familiar with the google tooling - SKIA as a static library ?

2016-12-28 Thread Basile B via Digitalmars-d-learn
I'd like to build SKIA[1] as a static library and interface it with D. However it's hard to build, I don't get anything to their build system... Thanks for your help. [1]https://skia.org/

Re: Swap front for char[] input ranges

2016-12-19 Thread Basile B. via Digitalmars-d-learn
On Monday, 19 December 2016 at 10:41:46 UTC, RazvanN wrote: Hi, I have a function which accepts 2 input Ranges and swaps the first element in Range1 with the first element in Range2. The swapping code looks something like this : static if (is(typeof(swap(r1.front, r2.front {

Re: meaning of "auto ref const"?

2016-12-18 Thread Basile B. via Digitalmars-d-learn
On Sunday, 18 December 2016 at 13:14:08 UTC, Picaud Vincent wrote: Reading std/bigint.d code: https://github.com/dlang/phobos/blob/00c1cc3b0d354363793c8b419ce84da722578138/std/bigint.d#L589 I have seen this: bool opEquals()(auto ref const BigInt y) const pure @nogc { return sign == y.sign

Re: DRY version of `static if(__traits(compiles, expr)) fun(expr)`

2016-12-14 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 14 December 2016 at 22:06:35 UTC, Ali Çehreli wrote: On 12/14/2016 09:25 AM, Basile B. wrote: > On Tuesday, 13 December 2016 at 23:37:59 UTC, Timon Gehr wrote: >> I usually do >> >> enum code = q{expr}; >> static if(__traits(compiles,mixin(code))) >> fun(mixin(code)); > >

Re: Simplest way to build a DMD compatible C lib, and how to link using DUB.

2016-12-14 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 14 December 2016 at 23:08:30 UTC, hardreset wrote: I built Freetype with MSVC13 and tried to link it but DMD didnt like the format, so what should compiler (free) should I use for building DMD compatible static libs? Once I've build the lib, made a di file, where do I put these

Re: DRY version of `static if(__traits(compiles, expr)) fun(expr)`

2016-12-14 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 23:37:59 UTC, Timon Gehr wrote: On 14.12.2016 00:00, Timothee Cour via Digitalmars-d-learn wrote: what's the best (and DRY) way to achieve: ``` static if(__traits(compiles, expr)) fun(expr); ``` ie, without repeating the expression inside expr? eg: ```

Re: How to serialize a double.

2016-11-30 Thread Basile B. via Digitalmars-d-learn
On Thursday, 1 December 2016 at 00:36:30 UTC, Jake Pittis wrote: How do I convert a double to a ubyte[]? I've tried all sorts of things including converting the double to a ulong and trying to serialize the ulong. For example test bellow fails. unittest { double d = 3.14; ulong

Re: Use class template as a type

2016-11-30 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 30 November 2016 at 14:53:21 UTC, ag0aep6g wrote: On 11/30/2016 10:42 AM, Bauss wrote: Usually casts to base classes can be determined if they're valid at compile-time. Yeah, that's what I said. A cast to a base class is an "upcast". Upcasts don't need run-time checks. The

Re: Use class template as a type

2016-11-28 Thread Basile B. via Digitalmars-d-learn
On Monday, 28 November 2016 at 14:35:36 UTC, Namespace wrote: We have a handy dandy syntax for this: if (MyClassInt subclass = cast(MyClassInt)value) { writeln(subclass.value); } If it doesn't cast to said type (it will be null) that branch won't execute. Just out of interest: it

Re: how to debug exceptions/asserts thrown in module constructors?

2016-11-27 Thread Basile B. via Digitalmars-d-learn
On Monday, 28 November 2016 at 02:52:02 UTC, Basile B. wrote: On Sunday, 27 November 2016 at 22:19:26 UTC, Timothee Cour wrote: Adding ``` b _d_throwc #does nothing ``` Don't ask me why I wouldn't be able to answer. The only thing that I can say is that it's probably related to one of the

Re: how to debug exceptions/asserts thrown in module constructors?

2016-11-27 Thread Basile B. via Digitalmars-d-learn
On Sunday, 27 November 2016 at 22:19:26 UTC, Timothee Cour wrote: Adding ``` b _d_throwc #does nothing ``` Try instead "b _d_throwdwarf". Changes made earlier this year to EH made _d_throwc obsolete. The equivalent is now _d_throwdwarf. Don't ask me why I wouldn't be able to answer.

Re: Linking g++ compiled object files

2016-11-24 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 23 November 2016 at 19:49:35 UTC, Rubikoid wrote: For example, i have test.cpp: #include void test() { printf("test\n"); } And test.d: import std.stdio; extern (C++) void test(); void main() { test(); readln(); } How i should compile test.cpp using g++ to link it

Re: implementing --version?

2016-11-21 Thread Basile B. via Digitalmars-d-learn
On Monday, 21 November 2016 at 23:46:41 UTC, Basile B. wrote: On Monday, 21 November 2016 at 21:32:16 UTC, mab-on wrote: What i want is a clever mechanism to store the SemVer (or Commit-ID) in the binary at compiletime - automatically. Otherwise i have to think to update a const in the code

Re: implementing --version?

2016-11-21 Thread Basile B. via Digitalmars-d-learn
On Monday, 21 November 2016 at 21:32:16 UTC, mab-on wrote: What i want is a clever mechanism to store the SemVer (or Commit-ID) in the binary at compiletime - automatically. Otherwise i have to think to update a const in the code every time i build a new Version. enum versionData =

Re: Converting all enum members to a string fails with version 2.0.72.0

2016-11-21 Thread Basile B. via Digitalmars-d-learn
On Monday, 21 November 2016 at 17:26:37 UTC, Jonathan M Davis wrote: On Monday, November 21, 2016 17:01:56 Stefan via Digitalmars-d-learn wrote: [...] [...] there was an overload for toUpper that took string as an optimization but that inadvertently meant that types that implicitly converted

Re: Memory allocation failed. Why?

2016-11-20 Thread Basile B. via Digitalmars-d-learn
On Sunday, 20 November 2016 at 17:47:50 UTC, MGW wrote: import core.sys.windows.windows: MessageBoxA; void test() { for(int i; i != 10; i++) { ubyte[] buf; for(int j; j != 1; j++) buf ~= 65; MessageBoxA(null, "--on for--".ptr,

Re: what is mean? ( Offset 78887H Record Type 00C3)

2016-11-19 Thread Basile B. via Digitalmars-d-learn
On Saturday, 19 November 2016 at 08:59:36 UTC, xky wrote: On Saturday, 19 November 2016 at 07:12:49 UTC, Nicholas Wilson wrote: If you're using x64 then you should be using the microsoft linker. ok are you invoking the linker manually? no... So, I got msbuild.zip from another website and

Re: Thread (spawn) for object's method

2016-11-07 Thread Basile B. via Digitalmars-d-learn
On Monday, 7 November 2016 at 16:15:44 UTC, Konstantin Kutsevalov wrote: Is there a way to make new thread for class method? E.g. I have some class and I need to run one of them method in new thread. I found wxamples only with function... import core.thread; class Foo { void

Re: New to D and mimicking C++ : how to implement std::integral_constant<>?

2016-11-07 Thread Basile B. via Digitalmars-d-learn
On Monday, 7 November 2016 at 23:03:32 UTC, Picaud Vincent wrote: I need: 1/ a way to detect compile-time constant vs "dynamic" values /** * Indicates if something is a value known at compile time. * * Params: * V = The value to test. * T = Optional, the expected value type.

Re: check instance of nested variadic template

2016-11-05 Thread Basile B. via Digitalmars-d-learn
On Saturday, 5 November 2016 at 13:43:34 UTC, Lodovico Giaretta wrote: On Saturday, 5 November 2016 at 13:34:51 UTC, Gianni Pisetta wrote: When i have time i will test it with ldc and see if the result is the same, then it will probably be a front-end bug and i will report it as an issue. I

Re: check instance of nested variadic template

2016-11-05 Thread Basile B. via Digitalmars-d-learn
On Saturday, 5 November 2016 at 14:37:53 UTC, Basile B. wrote: On Saturday, 5 November 2016 at 13:34:51 UTC, Gianni Pisetta wrote: [...] Indeed, I've been fighting against that since a few minutes. We cant select the Base of an eponymous template. template isEponymousTemplate(T) {

Re: check instance of nested variadic template

2016-11-05 Thread Basile B. via Digitalmars-d-learn
On Saturday, 5 November 2016 at 13:34:51 UTC, Gianni Pisetta wrote: When i have time i will test it with ldc and see if the result is the same, then it will probably be a front-end bug and i will report it as an issue. Indeed, I've been fighting against that since a few minutes. We cant

Re: check instance of nested variadic template

2016-11-05 Thread Basile B. via Digitalmars-d-learn
On Friday, 4 November 2016 at 17:37:10 UTC, Basile B. wrote: On Friday, 4 November 2016 at 15:50:36 UTC, Gianni Pisetta wrote: Hi all, I am having issues finding a solution for this, i want to check if an alias is an istance of a variadic template nested in another variadic template. [...]

Re: system's "kill " signal

2016-11-05 Thread Basile B. via Digitalmars-d-learn
On Saturday, 5 November 2016 at 06:17:51 UTC, Basile B. wrote: On Saturday, 5 November 2016 at 02:24:00 UTC, Konstantin Kutsevalov wrote: Hi, is there a way to catch system signal of "kill" command or "shutdown"? During the Run-time: You can register a signal callback,

Re: system's "kill " signal

2016-11-05 Thread Basile B. via Digitalmars-d-learn
On Saturday, 5 November 2016 at 02:24:00 UTC, Konstantin Kutsevalov wrote: Hi, is there a way to catch system signal of "kill" command or "shutdown"? During the Run-time: You can register a signal callback, like in this sample (hit CTRL+C once running in a terminal):

Re: check instance of nested variadic template

2016-11-04 Thread Basile B. via Digitalmars-d-learn
On Friday, 4 November 2016 at 15:50:36 UTC, Gianni Pisetta wrote: Hi all, I am having issues finding a solution for this, i want to check if an alias is an istance of a variadic template nested in another variadic template. [...] there is some sort of workaround? Thanks, Gianni Hello, I'm

Re: Assistance with DUB

2016-11-02 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 1 November 2016 at 22:01:23 UTC, Alfred Newman wrote: Greetings, I need some help with dub libraries. Executing "dub list" in my machine, I got the following: Packages present in the system and known to dub: colorize ~master:

CTFE divide by 0 prints the same error 3 times !

2016-10-28 Thread Basile B. via Digitalmars-d-learn
try this echo "enum a = 0/0;" > d.d && dmd d.d -main any reason for this ?

Is there a D static site generator based on markdown (like couscous) ?

2016-10-28 Thread Basile B. via Digitalmars-d-learn
I would need actually something like https://github.com/CouscousPHP/Couscous but in D.

Re: exercise - find invalid D tokens (Impossible ?)

2016-10-28 Thread Basile B. via Digitalmars-d-learn
On Friday, 28 October 2016 at 06:21:38 UTC, Johan Engelen wrote: On Friday, 28 October 2016 at 05:16:45 UTC, Basile B. wrote: Here are the specifications of token strings: "Token strings open with the characters q{ and close with the token }. In between must be valid D tokens. The { and }"

exercise - find invalid D tokens (Impossible ?)

2016-10-27 Thread Basile B. via Digitalmars-d-learn
Here are the specifications of token strings: "Token strings open with the characters q{ and close with the token }. In between must be valid D tokens. The { and }" So we can deduce that any invalid D token inside a token string will lead to a compilation error. Indeed: void main() {

Re: test if the alias of a template is a literal

2016-10-27 Thread Basile B. via Digitalmars-d-learn
On Friday, 28 October 2016 at 03:33:33 UTC, Basile B. wrote: On Thursday, 27 October 2016 at 14:04:23 UTC, Gianni Pisetta wrote: So i searched for a metod to check if an alias is a literal value, but found nothing. Anyone have any clue on how can be done? Thanks, Gianni Pisetta Hello, I

Re: test if the alias of a template is a literal

2016-10-27 Thread Basile B. via Digitalmars-d-learn
On Thursday, 27 October 2016 at 14:04:23 UTC, Gianni Pisetta wrote: Hi all, I have an AliasSeq composed of literal strings, variables and delegates. I want to build a template Optimize that will return an AliasSeq that have all adjacent literals concatenated into one. So i writed something

Re: How to kill whole application if child thread raises an exception?

2016-10-26 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 09:43:10 UTC, rikki cattermole wrote: Basically when you spawn a thread giving the function, you pass it through another function which will catch any exceptions not normally caught. Of course this really should be the default behavior but somebody else may

Re: Phobos lacks a particular family of range functions...

2016-10-22 Thread Basile B. via Digitalmars-d-learn
On Friday, 21 October 2016 at 19:41:00 UTC, Basile B. wrote: They would have for constraint `if (isInputRange!Range && isInputRange!(ElementType!Range))` In case you wouldn't see directly what would they be used for, it's for tree-like structures. Each element in a Range is also an input

Phobos lacks a particular family of range functions...

2016-10-21 Thread Basile B. via Digitalmars-d-learn
They would have for constraint `if (isInputRange!Range && isInputRange!(ElementType!Range))` In case you wouldn't see directly what would they be used for, it's for tree-like structures. Each element in a Range is also an input range. I see 3 obvious functions/templates - the most

Is this a bug ?

2016-10-21 Thread Basile B. via Digitalmars-d-learn
This very simple stuff: class Item { alias children this; Item[] children; void populate() { children ~= new Item; assert(children.length == 1); } } void main() { Item root = new Item; root.populate; } leads to an assertion failure. Am I too tired to

Re: List defined version specifications

2016-10-19 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 19 October 2016 at 10:25:51 UTC, Lodovico Giaretta wrote: Hi! A simple question: is there a way to list all defined version specifications? Something like: pragma(msg, __traits(allVersions)); Example output (DMD on Ubuntu x64, release build): [all,

Re: std.experimental.allocator and GC.addRange

2016-10-19 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 19 October 2016 at 08:34:57 UTC, Benjamin Thaut wrote: Lets assume I have a allocator which cains together multiple building blocks from std.experimental.allocator and at the end there is a mallocator providing the underlying memory. Now I alloacte a type which contains a pointer

Re: TIL: auto struct members

2016-10-18 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 18 October 2016 at 22:12:47 UTC, Ali Çehreli wrote: It may be embarrassing to discover this fact so late but you can define struct members as 'auto': import std.range; import std.algorithm; struct S { auto r = only("a", "b").cycle;// <-- WOW! } pragma(msg, typeof(S.r));

Re: Render SVG To Display And Update Periodically

2016-10-18 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 18 October 2016 at 21:00:12 UTC, Karabuta wrote: On Monday, 17 October 2016 at 07:18:40 UTC, ketmar wrote: On Monday, 17 October 2016 at 07:05:24 UTC, ketmar wrote: [...] oops, forgot to give some links. ;-) nanovg and nanosvg ports: http://repo.or.cz/iv.d.git/tree/HEAD:/nanovg

Re: About debugging (again)

2016-10-17 Thread Basile B. via Digitalmars-d-learn
On Monday, 17 October 2016 at 19:14:49 UTC, ANtlord wrote: On Monday, 17 October 2016 at 17:57:19 UTC, Martin Krejcirik wrote: On Monday, 17 October 2016 at 15:45:56 UTC, ANtlord wrote: GDB 7.7.1 Use latest GDB, 7.10 has got much better D support. Tested on GDB 7.11.1. Same case :(

Re: Range violation with AAs

2016-10-17 Thread Basile B. via Digitalmars-d-learn
On Monday, 17 October 2016 at 17:43:19 UTC, Nordlöw wrote: At https://github.com/nordlow/phobos-next/blob/master/src/array_ex.d I have an array container. Everything works as expected in all unittests except for the line at

Re: About debugging (again)

2016-10-17 Thread Basile B. via Digitalmars-d-learn
On Monday, 17 October 2016 at 17:46:05 UTC, Basile B. wrote: On Monday, 17 October 2016 at 15:45:56 UTC, ANtlord wrote: On Monday, 17 October 2016 at 15:43:32 UTC, ANtlord wrote: [...] Oh Sorry, I've forgotten about pointing technical parameters. Ubuntu 14.04 GDB 7.7.1 DMD64 D Compiler

Re: About debugging (again)

2016-10-17 Thread Basile B. via Digitalmars-d-learn
On Monday, 17 October 2016 at 15:45:56 UTC, ANtlord wrote: On Monday, 17 October 2016 at 15:43:32 UTC, ANtlord wrote: Hello! I've met an issue related to debugging by GDB. Directly when I try to show call stack I get like this http://pastebin.com/kRFRqznq. How can I make name of methods more

Re: how to understand different attribute styles?

2016-10-17 Thread Basile B. via Digitalmars-d-learn
On Monday, 17 October 2016 at 14:12:33 UTC, timepp wrote: there is "@disable", using @ as prefix; there is "__gshared", using __ as prefix; there is also "align", not using prefix. I failed to summarize a rule here. Can anyone tell the underlined philosophy? It's an inconsistency of the

Re: Bug or case of hijacking protection ?

2016-10-17 Thread Basile B. via Digitalmars-d-learn
On Monday, 17 October 2016 at 14:01:26 UTC, Basile B. wrote: Is this a bug or a case of hijacking protection ? struct S { void test(void*, size_t){} } void test(ref S,void[]){} void main() { ubyte[] a; (*new S).test(a); }

Bug or case of hijacking protection ?

2016-10-17 Thread Basile B. via Digitalmars-d-learn
Is this a bug or a case of hijacking protection ? struct S { void test(void*, size_t){} } void test(ref S,void[]){} void main() { ubyte[] a; (*new S).test(a); }

Re: Determining if a class has a template function

2016-10-12 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 11 October 2016 at 20:17:19 UTC, Straivers wrote: I have a class T with a templated function foo(string name)(int, int, float) that will be mixed in via template, and I want to determine if that class has mixed it in such that foo(name = "bar"). How could I go about this? Thanks.

Re: obscure messages relating to linking and imports in 2.071.1

2016-10-05 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 12:12:24 UTC, Basile B. wrote: On Wednesday, 5 October 2016 at 11:45:49 UTC, Laeeth Isharc wrote: I noticed the problem before - previously it was my fault. I had a circulator dependency where A imported B, B did a selective import of C and C imported A

Re: obscure messages relating to linking and imports in 2.071.1

2016-10-05 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 11:45:49 UTC, Laeeth Isharc wrote: I noticed the problem before - previously it was my fault. I had a circulator dependency where A imported B, B did a selective import of C and C imported A selectively. That led to link problems with module constructors.

Re: Class attributes

2016-10-02 Thread Basile B. via Digitalmars-d-learn
On Sunday, 2 October 2016 at 15:54:38 UTC, Satoshi wrote: Hello, why pure @safe nothrow @nogc struct Point { } isn't same as struct Point { pure: @safe: nothrow: @nogc: } ?? This is not specified but attributes aren't applied to the scope created by the declaration. Which is a good thing,

Re: Is there any way to have [] overloads use compile-time indexes as is currently done for Tuples?

2016-09-27 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 27 September 2016 at 09:21:04 UTC, pineapple wrote: I'd really like to define my own types that accept indexes for opIndex and opSlice as template arguments. Is there any way to do this? If not, this seems like an obvious thing to add to the language - what's been holding it back?

<    1   2   3   4   5   6   7   8   >