Re: Bitfields?

2016-12-31 Thread jkpl via Digitalmars-d
On Friday, 30 December 2016 at 13:45:23 UTC, Martin wrote: Are there any C-like bitfields in D? Yes - How can I use them? No - What could be used in their stead? If you're okay with dependencies and if you use DUB there's this very decent wrapper called EnumSet: - https://code

Re: Bitfields?

2016-12-30 Thread Martin via Digitalmars-d
On Friday, 30 December 2016 at 14:06:06 UTC, Marc Schütz wrote: On Friday, 30 December 2016 at 13:45:23 UTC, Martin wrote: Are there any C-like bitfields in D? Yes - How can I use them? No - What could be used in their stead? Not built-in, but in the standard library: https://dlang.org

Re: Bitfields?

2016-12-30 Thread Marc Schütz via Digitalmars-d
On Friday, 30 December 2016 at 13:45:23 UTC, Martin wrote: Are there any C-like bitfields in D? Yes - How can I use them? No - What could be used in their stead? Not built-in, but in the standard library: https://dlang.org/phobos/std_bitmanip.html#.bitfields

Bitfields?

2016-12-30 Thread Martin via Digitalmars-d
Are there any C-like bitfields in D? Yes - How can I use them? No - What could be used in their stead?

Re: bitfields VS pure nothrow

2012-05-13 Thread Guillaume Chatelet
On 05/13/12 23:01, David Nadlinger wrote: > Yes, the getters and setters should be both pure and nothrow. > > Your question about purity actually roots in a quite common > misunderstanding – I have a pretty comprehensive article on the > topic in the pipe, hope to be able to finish it later this w

Re: bitfields VS pure nothrow

2012-05-13 Thread Alex Rønne Petersen
On 13-05-2012 21:51, Guillaume Chatelet wrote: Sure enough bitfields is a strange beast and I ran into some subtleties with purity and nothrow. Consider the following code : -- struct POD { int a; } int getA(POD o) pure nothrow { return o.a; } POD setA(POD

Re: bitfields VS pure nothrow

2012-05-13 Thread David Nadlinger
On Sunday, 13 May 2012 at 20:49:13 UTC, Guillaume Chatelet wrote: IMHO getters and setters could be nothrow but what about purity? Looks like it's a bit far-fetched to qualify member methods as pure right? Yet it makes sense regarding the semantic. What's your take on that? Yes, the getters a

bitfields VS pure nothrow

2012-05-13 Thread Guillaume Chatelet
Sure enough bitfields is a strange beast and I ran into some subtleties with purity and nothrow. Consider the following code : -- struct POD { int a; } int getA(POD o) pure nothrow { return o.a; } POD setA(POD o, int value) pure nothrow { o.a = value

Re: More for bitfields

2010-07-04 Thread bearophile
Andrei Alexandrescu: > Sounds good. Did you have a chance to enter that into bugzilla? Done: http://d.puremagic.com/issues/show_bug.cgi?id=4425 Bye, bearophile

Re: More for bitfields

2010-07-04 Thread Andrei Alexandrescu
bearophile wrote: This blog post shows possible ideas to make std.bitmanip.bitfields more complete: http://potential-lang.org/2010/07/02/quasi-quoting-ascii-art-to-define-data-structures/ An example of the ideas: struct IntDesc_t { ... immutable IST : 3 = 0; immutable Unused0 : 5 = 0; i

Re: More for bitfields

2010-07-04 Thread Ellery Newcomer
phile How is this different from erlang's bitfields, aside from the mutable/immutable part?

More for bitfields

2010-07-04 Thread bearophile
This blog post shows possible ideas to make std.bitmanip.bitfields more complete: http://potential-lang.org/2010/07/02/quasi-quoting-ascii-art-to-define-data-structures/ An example of the ideas: struct IntDesc_t { ... immutable IST : 3 = 0; immutable Unused0 : 5 = 0; immutable type : 4 =