Transitive bit-packing of fields

2017-04-30 Thread Nordlöw via Digitalmars-d-learn
Have anybody found a way to do transitive packing of bitfields? For instance, in import std.bitmanip : bitfields; struct X { // one bit too many to fit in one byte mixin(bitfields!(bool, `a`, 1, bool, `b`, 1, ubyte, `c`, 7,

Re: Problem with using readln.

2017-04-30 Thread Ivan Kazmenko via Digitalmars-d-learn
On Sunday, 30 April 2017 at 02:07:48 UTC, JV wrote: Hello i'm kinda new to D language and i wanted to make a simple program but somehow my input does no go to my if statements and just continues to ask for the user to input.Kindly help me One way would be: import std.stdio; int x;

Re: interfacing Cpp - GCC Dual ABI abi_tag in name mangling

2017-04-30 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-04-29 20:08, سليمان السهمي (Soulaïman Sahmi) wrote: GCC has this attribute called abi_tag that they put on any function that returns std::string or std::list, for the rational behind that read here:https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html . the special thing wit

Re: Transitive bit-packing of fields

2017-04-30 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 30 April 2017 at 11:02:52 UTC, Nordlöw wrote: Have anybody found a way to do transitive packing of bitfields? For instance, in import std.bitmanip : bitfields; struct X { // one bit too many to fit in one byte mixin(bitfields!(bool, `a`, 1, bool, `b`, 1

Re: Transitive bit-packing of fields

2017-04-30 Thread Per Nordlöw via Digitalmars-d-learn
On Sunday, 30 April 2017 at 13:22:49 UTC, Stefan Koch wrote: On Sunday, 30 April 2017 at 11:02:52 UTC, Nordlöw wrote: Have anybody found a way to do transitive packing of bitfields? For instance, in import std.bitmanip : bitfields; struct X { // one bit too many to fit in one byte mi

String Comparison Operator

2017-04-30 Thread Jolly James via Digitalmars-d-learn
Is there a String Comparison Operator in D?

Re: String Comparison Operator

2017-04-30 Thread 無 via Digitalmars-d-learn
On Sunday, 30 April 2017 at 15:31:39 UTC, Jolly James wrote: Is there a String Comparison Operator in D? ~

Re: alias can't find symbol or can't use symbol

2017-04-30 Thread Carl Sturtivant via Digitalmars-d-learn
On Sunday, 30 April 2017 at 02:19:29 UTC, bauss wrote: What exactly did you expect here? 'n' is not in the scope of 'outer'. 'n' is in the scope of 'member'. Of course it works with 'x.n' since 'x' points to the 'member' declared inside 'outer'. I mean it would have worked with classes, but

Re: String Comparison Operator

2017-04-30 Thread Xinok via Digitalmars-d-learn
On Sunday, 30 April 2017 at 15:31:39 UTC, Jolly James wrote: Is there a String Comparison Operator in D? Yeah, just the usual comparison operators: "abc" == "abc" "abc" != "ABC" ~ is for string concatenation, i.e.: "abc" ~ "def" == "abcdef"

Re: String Comparison Operator

2017-04-30 Thread tcak via Digitalmars-d-learn
On Sunday, 30 April 2017 at 15:31:39 UTC, Jolly James wrote: Is there a String Comparison Operator in D? You normally use double equation marks (==) to do that. auto name = "Jack"; if( name == "Jack" ) writeln("Hi Jack!");

protected behaviour on base class member access from another module

2017-04-30 Thread Boris-Barboris via Digitalmars-d-learn
Hi! I have a base class in module A: module A; ... class GuiElement: GuiComponent { protected { GuiElement _parent; ... } template isGuiElement(T) { enum isGuiElement = is(T: GuiElement); } ... and derived class in module B: module B; ... class Div(uint dim, uint odim): G

Re: interfacing Cpp - GCC Dual ABI abi_tag in name mangling

2017-04-30 Thread via Digitalmars-d-learn
On Sunday, 30 April 2017 at 11:35:54 UTC, Jacob Carlborg wrote: You can use pragma(mangle, "some mangling"); to set the mangled name of a symbol. that's a quick hack, but sooner or later dmd needs to add some rules for this in the internal cpp mangler, since gcc is the main compiler in gnu/li

Re: String Comparison Operator

2017-04-30 Thread bauss via Digitalmars-d-learn
On Sunday, 30 April 2017 at 16:15:41 UTC, Xinok wrote: On Sunday, 30 April 2017 at 15:31:39 UTC, Jolly James wrote: Is there a String Comparison Operator in D? Yeah, just the usual comparison operators: "abc" == "abc" "abc" != "ABC" ~ is for string concatenation, i.e.: "abc" ~ "def" == "ab

Re: protected behaviour on base class member access from another module

2017-04-30 Thread Boris-Barboris via Digitalmars-d-learn
Ok, sorry, look's like that was always the case in C++, so it's too late to question it. I'll just elevate it to package, I guess.

How to correctly generate enums at compile time.

2017-04-30 Thread Kevin Balbas via Digitalmars-d-learn
I've got the following code snippet, which almost does what I want. struct TaggedType {} @TaggedType struct Foo {} @TaggedType struct Bar {} string GenerateTypeEnum() { string enumString = "enum TypeEnum {"; foreach (name; __traits(allMembers, mixin(__MODULE__))) { import

Stack Trace format

2017-04-30 Thread Szabo Bogdan via Digitalmars-d-learn
Hi, I noticed that on different platforms the `object.Throwable.TraceInfo` has different formats. A program compiled on osx with ldc2 has all the TraceInfo empty... Why? I want to parse those strings or somehow iterate trough all the stack elements, but if I get a different format on differe

Re: Stack Trace format

2017-04-30 Thread Szabo Bogdan via Digitalmars-d-learn
On Sunday, 30 April 2017 at 20:31:09 UTC, Szabo Bogdan wrote: Hi, I noticed that on different platforms the `object.Throwable.TraceInfo` has different formats. A program compiled on osx with ldc2 has all the TraceInfo empty... Why? I want to parse those strings or somehow iterate trough all

Re: String Comparison Operator

2017-04-30 Thread ag0aep6g via Digitalmars-d-learn
On 04/30/2017 09:05 PM, bauss wrote: On Sunday, 30 April 2017 at 16:15:41 UTC, Xinok wrote: [...] ~ is for string concatenation, i.e.: [...] It's not actually a string concatenation operator, it's an array appending operator. Appending is related but distinct. `~` does concatenation. `~=` d

Re: How to correctly generate enums at compile time.

2017-04-30 Thread jkpl via Digitalmars-d-learn
On Sunday, 30 April 2017 at 20:05:59 UTC, Kevin Balbas wrote: I've got the following code snippet, which almost does what I want. struct TaggedType {} @TaggedType struct Foo {} @TaggedType struct Bar {} string GenerateTypeEnum() { string enumString = "enum TypeEnum {"; foreach (name;

Re: How to correctly generate enums at compile time.

2017-04-30 Thread Kevin Balbas via Digitalmars-d-learn
On Sunday, 30 April 2017 at 20:58:36 UTC, jkpl wrote: On Sunday, 30 April 2017 at 20:05:59 UTC, Kevin Balbas wrote: I've got the following code snippet, which almost does what I want. struct TaggedType {} @TaggedType struct Foo {} @TaggedType struct Bar {} string GenerateTypeEnum() { st

Re: alias can't find symbol or can't use symbol

2017-04-30 Thread Jerry via Digitalmars-d-learn
To me this seems like a bug.

Re: String Comparison Operator

2017-04-30 Thread Xinok via Digitalmars-d-learn
On Sunday, 30 April 2017 at 19:05:18 UTC, bauss wrote: On Sunday, 30 April 2017 at 16:15:41 UTC, Xinok wrote: On Sunday, 30 April 2017 at 15:31:39 UTC, Jolly James wrote: Is there a String Comparison Operator in D? Yeah, just the usual comparison operators: "abc" == "abc" "abc" != "ABC" ~

Re: How to correctly generate enums at compile time.

2017-04-30 Thread jkpl via Digitalmars-d-learn
On Sunday, 30 April 2017 at 21:13:07 UTC, Kevin Balbas wrote: On Sunday, 30 April 2017 at 20:58:36 UTC, jkpl wrote: On Sunday, 30 April 2017 at 20:05:59 UTC, Kevin Balbas wrote: Strangely enough, it does work fine in the test snippet, As well if you import the snippet in another module. That'

Re: How to correctly generate enums at compile time.

2017-04-30 Thread Kevin Balbas via Digitalmars-d-learn
On Sunday, 30 April 2017 at 21:31:22 UTC, jkpl wrote: On Sunday, 30 April 2017 at 21:13:07 UTC, Kevin Balbas wrote: On Sunday, 30 April 2017 at 20:58:36 UTC, jkpl wrote: On Sunday, 30 April 2017 at 20:05:59 UTC, Kevin Balbas wrote: Strangely enough, it does work fine in the test snippet, As

Re: How to correctly generate enums at compile time.

2017-04-30 Thread jkpl via Digitalmars-d-learn
On Sunday, 30 April 2017 at 22:03:02 UTC, Kevin Balbas wrote: On Sunday, 30 April 2017 at 21:31:22 UTC, jkpl wrote: On Sunday, 30 April 2017 at 21:13:07 UTC, Kevin Balbas wrote: On Sunday, 30 April 2017 at 20:58:36 UTC, jkpl wrote: On Sunday, 30 April 2017 at 20:05:59 UTC, Kevin Balbas wrote:

Is dmc package still required?

2017-04-30 Thread Andrew Godfrey via Digitalmars-d-learn
I just updated to 2.074.0. I see there's still a README.TXT which tells me (on windows) to download dmc, "which contains the linker and necessary libraries". Is this out of date? I see a "link.exe" in the dmd package. Granted it's a bit older, but do I care?