On Sunday, 9 April 2017 at 05:42:02 UTC, Jethro wrote:
Suppose one has a function that will be used in CTFE and it
uses a lot of local variables. Does each call of the function
end up allocating space for these without ever releasing them
or are they reused? or used on the stack like normal?
On 09/04/2017 7:30 AM, Jethro wrote:
void foo(A...)(A a)
{
foreach(aa; a)
{
for(int i = 0; i < a.length; i++)
...
}
}
A can be strings or char, how can I easily deal with both? (e.g.,
a.length = 1 for a being a char... and also a[0] = a, so to speak).
That is, I
void foo(A...)(A a)
{
foreach(aa; a)
{
for(int i = 0; i < a.length; i++)
...
}
}
A can be strings or char, how can I easily deal with both? (e.g.,
a.length = 1 for a being a char... and also a[0] = a, so to
speak).
That is, I want chars to be treated as strings
On Saturday, 8 April 2017 at 22:37:18 UTC, ag0aep6g wrote:
On 04/08/2017 11:59 PM, Meta wrote:
enum a = 0;
template test1()
{
enum b1 = a; //Okay, a is in scope at the declaration site
//enum c = d1; Error: undefined identifier d1
This line works just fine, actually. There's really no
Suppose one has a function that will be used in CTFE and it uses
a lot of local variables. Does each call of the function end up
allocating space for these without ever releasing them or are
they reused? or used on the stack like normal?
I'm trying to use a binary heap initialized with one element.
However, this always seems to cause a range violation for some
reason. This small example will do it:
import std.stdio, std.container;
void main() {
auto pq = heapify([5]);
pq.insert(8);
}
...And it produces this error: https:/
Might I suggest that you simply define an enum for UnixEpoch
that's a
SysTime. Then you can do whatever you want.
ping on this.
On 04/08/2017 11:59 PM, Meta wrote:
enum a = 0;
template test1()
{
enum b1 = a; //Okay, a is in scope at the declaration site
//enum c = d1; Error: undefined identifier d1
This line works just fine, actually. There's really no difference
between a normal template and a mixin template
On Saturday, 8 April 2017 at 09:47:07 UTC, biocyberman wrote:
On Friday, 7 April 2017 at 23:53:12 UTC, Ali Çehreli wrote:
The difference is that you can't use funcgen as a regular
template:
funcgen!(void, void);
Error: template instance funcgen!(void, void) mixin templates
are not regu
On Saturday, 8 April 2017 at 21:29:58 UTC, new2d wrote:
Can someone experienced in D port the GNU Guile embedding
tutorial over?
It would be great if Guile can be used to embed in D
Thank you
https://www.gnu.org/software/guile/docs/guile-tut/tutorial.html#Fundamentals
I have embedded Guile
On 04/08/2017 03:11 AM, biocyberman wrote:
> On Saturday, 8 April 2017 at 10:02:01 UTC, Mike Parker wrote:
>>
>> I would expect if you implement it as a function the compiler will
>> inline it. You can always use the pragma(inline, true) [1] with
>> -inline to verify.
>>
>> [1] https://dlang.org/s
Hello folks,
The default dmd.conf settings for 64-bit environments include the
-fPIC flag (for good reason), but the settings for 32-bit
environments do not. Any particular reason for this?
Thanks & best wishes,
-- Joe
Can someone experienced in D port the GNU Guile embedding
tutorial over?
It would be great if Guile can be used to embed in D
Thank you
https://www.gnu.org/software/guile/docs/guile-tut/tutorial.html#Fundamentals
On 2017-04-07 23:05, Ali Çehreli wrote:
Main reason for D not supporting the name-to-pointer mapping? I don't
think so because as far as I know this has been the case since very
early on but UFCS came very much later.
More likely due to properties, i.e. calling functions without
parentheses.
On Saturday, 8 April 2017 at 12:14:31 UTC, Russel Winder wrote:
On Fri, 2017-04-07 at 22:47 +, Meta via Digitalmars-d-learn
wrote:
[…]
Do you have the -dip1000 switch enabled?
Not as far as I know. Why would I want to do that?
You wouldn't as the std lib doesn't work with it yet.
On 04/07/2017 07:06 PM, Russel Winder via Digitalmars-d-learn wrote:
factorial.d(71,15): Error: template std.bigint.BigInt.__ctor cannot deduce
function from argument types !()(string) immutable
On 04/08/2017 02:18 PM, Russel Winder via Digitalmars-d-learn wrote:
https://github.com/russel/Fac
On Saturday, 8 April 2017 at 12:16:10 UTC, Russel Winder wrote:
Fedora Rawhide is now on LLVM 4.0 is that going to be a problem
building LDC?
Of course not! ;-)
-Johan
On Fri, 2017-04-07 at 20:29 +, Jack Stouffer via Digitalmars-d-
learn wrote:
> On Friday, 7 April 2017 at 17:06:31 UTC, Russel Winder wrote:
> > Simple Dub build of a Factorial example using Unit-Threaded for
> > testing. Works fine with ldc2 breaks with dmd.
>
> Can you post the code your us
On Fri, 2017-04-07 at 20:38 +, David Nadlinger via Digitalmars-d-
learn wrote:
> […]
>
> You might want to check with LDC from Git master first to see
> whether it is in fact a 2.073-related problem. — David
Rats, I thought I'd got away from manually building LDC.
Fedora Rawhide is now on L
On Fri, 2017-04-07 at 22:47 +, Meta via Digitalmars-d-learn wrote:
> […]
>
> Do you have the -dip1000 switch enabled?
Not as far as I know. Why would I want to do that?
--
Russel.
=
Dr Russel Winder t: +44 20 7
On Saturday, 8 April 2017 at 11:24:02 UTC, Nicholas Wilson wrote:
The ':' means that it applies to everything that follows it, so
while it doesn't matters in this example if you had
pragma( inline, true ):
int kroundup32( int x) { ... }
auto someVeryLargeFunction( Args args)
{
// ...
}
an
On Saturday, 8 April 2017 at 11:01:34 UTC, biocyberman wrote:
On Saturday, 8 April 2017 at 10:09:47 UTC, Mike Parker wrote:
T kroundup32(T)(T x) {
pragma(inline, true);
--(x);
(x)|=(x)>>1;
(x)|=(x)>>2;
(x)|=(x)>>4;
(x)|=(x)>>8;
(x)|=(x)>>16;
return ++(x);
}
I a
On Saturday, 8 April 2017 at 10:09:47 UTC, Mike Parker wrote:
T kroundup32(T)(T x) {
pragma(inline, true);
--(x);
(x)|=(x)>>1;
(x)|=(x)>>2;
(x)|=(x)>>4;
(x)|=(x)>>8;
(x)|=(x)>>16;
return ++(x);
}
I also came up with this:
import std.stdio;
pragma( inline, true
On Saturday, 8 April 2017 at 10:02:01 UTC, Mike Parker wrote:
I would expect if you implement it as a function the compiler
will inline it. You can always use the pragma(inline, true) [1]
with -inline to verify.
[1] https://dlang.org/spec/pragma.html#inline
Thanks for mentioning pragma. Ho
On Saturday, 8 April 2017 at 10:02:01 UTC, Mike Parker wrote:
I would expect if you implement it as a function the compiler
will inline it. You can always use the pragma(inline, true) [1]
with -inline to verify.
[1] https://dlang.org/spec/pragma.html#inline
This gives me no error, so it d
On Saturday, 8 April 2017 at 09:53:47 UTC, biocyberman wrote:
What is the D mixin version equivalent to this macro:
#define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2,
(x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x))
The macro looks cryptic. What the macro does has been explained
here:
h
What is the D mixin version equivalent to this macro:
#define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2,
(x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x))
The macro looks cryptic. What the macro does has been explained
here:
http://stackoverflow.com/questions/3384852/could-someone-help-ex
On Friday, 7 April 2017 at 23:53:12 UTC, Ali Çehreli wrote:
The difference is that you can't use funcgen as a regular
template:
funcgen!(void, void);
Error: template instance funcgen!(void, void) mixin templates
are not regular templates
I think it's good practice to use 'mixin templa
On Sunday, 2 April 2017 at 19:00:30 UTC, Jon Degenhardt wrote:
On Friday, 31 March 2017 at 04:41:10 UTC, Joel wrote:
Linking...
ld: warning: pointer not aligned at address 0x10017A4C9
(_D30TypeInfo_AxS3std4file8DirEntry6__initZ + 16 from
.dub/build/application-debug-posix.osx-x86_64-dmd_2072-E
29 matches
Mail list logo