On Fri, 2014-05-30 at 16:44 +, Andrew Brown via Digitalmars-d-learn
wrote:
> GDC version 4.8.2,i guess that's my problem. This is what happens
> when you let Ubuntu look after your packages.
Debian Sid has GCC 4.9 packages, but that may not help?
--
Russel.
==
They may use different debugging formats, but just linking should
be possible, especially with import libraries.
private in D does not provide any strong guarantees, it only
controls direct access to the symbol. You effectively want some
sort of strict internal linkage attribute which does not exist in
D.
Some explanation how the seemingly different concepts "enumerated
value" and "manifest constant" are actually related:
Let's start with the "classical" enums as they're known from
C/C++. They are used to create lists of symbolic names:
enum Color { YELLOW, PINK, BLUE };
Internally, each
On Friday, 30 May 2014 at 20:48:44 UTC, Kagamin wrote:
You can try ldc, which uses mingw toolchain, it's probably
compatible with msvc.
I don't necessarily need to do this, I was just wondering if it
was possible. Mostly because MSVC provides a lot of import and
static libraries that DMC does
You can try ldc, which uses mingw toolchain, it's probably
compatible with msvc.
On Friday, 30 May 2014 at 18:41:55 UTC, Joseph Rushton Wakeling
via Digitalmars-d-learn wrote:
On 30/05/14 18:13, monarch_dodra via Digitalmars-d-learn wrote:
Are you sure you are compiling with the same version of dmd
and gdc? Fixes were
made to the rand.d library in the latest release, which c
On Fri, 30 May 2014 16:09:59 -0400, Philippe Sigaud
wrote:
On Friday, 30 May 2014 at 20:02:40 UTC, Steven Schveighoffer wrote:
If you want an opaque struct, you need to return it by pointer.
What do you mean? Like this?
Hidden* foo() { return new Hidden();}
?
Yes, this way you can con
Philippe Sigaud:
as foo is returning a value from a private type, it should be
considered private also.
I think this was discussed, but I don't know why Walter didn't
design like that. Perhaps someone else can give you an answer.
Bye,
bearophile
On Friday, 30 May 2014 at 20:02:40 UTC, Steven Schveighoffer
wrote:
If you want an opaque struct, you need to return it by pointer.
What do you mean? Like this?
Hidden* foo() { return new Hidden();}
?
Otherwise, the user must be able to know what type it is
(otherwise, how would he use it
I'm having fun running some unittests. I set up a simple homemade
mock of std.net.curl's functions that essentially just consists
of a global queue that I can add strings to and get back in a
predictable order when calling std.net.curl.get/post/etc.
I use this mock in a couple of different module
On Friday, 30 May 2014 at 19:54:00 UTC, safety0ff wrote:
On Friday, 30 May 2014 at 19:50:43 UTC, Philippe Sigaud wrote:
Am I misunderstanding something or is that a bug?
Try: auto foo() { return Hidden();}
This is incorrect, please ignore.
On Friday, 30 May 2014 at 19:54:00 UTC, safety0ff wrote:
On Friday, 30 May 2014 at 19:50:43 UTC, Philippe Sigaud wrote:
Am I misunderstanding something or is that a bug?
Try: auto foo() { return Hidden();}
I'm not seeing any difference? I'm still able to create a value
of type Hidden in an
On Fri, 30 May 2014 15:50:41 -0400, Philippe Sigaud
wrote:
I'm trying to 'hide' a type, so as not to see it outside its module. I
want to control the way it's created and used.
I know of Voldemort types and '@disable this', but for now I'm just
trying to use 'private'. Halas, it seems it
On Friday, 30 May 2014 at 19:50:43 UTC, Philippe Sigaud wrote:
Am I misunderstanding something or is that a bug?
Try: auto foo() { return Hidden();}
I'm trying to 'hide' a type, so as not to see it outside its
module. I want to control the way it's created and used.
I know of Voldemort types and '@disable this', but for now I'm
just trying to use 'private'. Halas, it seems it can be
circumvented:
*
module A;
private struct Hidd
On Fri, May 30, 2014 at 7:56 PM, Steven Schveighoffer wrote:
> You can as long as the value is known at compile time:
>
> http://dpaste.dzfl.pl/5a710bd80ab0
Oh wow.
And that works for static if also:
http://dpaste.dzfl.pl/f87321a47834
Man. That opens some new possibilities.
On 30/05/14 18:13, monarch_dodra via Digitalmars-d-learn wrote:
Are you sure you are compiling with the same version of dmd and gdc? Fixes were
made to the rand.d library in the latest release, which could explain the
difference you are observing.
Which fixes are you thinking of here ... ? I d
On Fri, 30 May 2014 13:34:38 -0400, Philippe Sigaud via
Digitalmars-d-learn wrote:
On Fri, May 30, 2014 at 7:28 PM, Ali Çehreli
wrote:
On 05/30/2014 08:30 AM, Russel Winder via Digitalmars-d-learn wrote:
enum double p0 = 0.0045;
As others have already said, p0 is a manifest con
On Fri, May 30, 2014 at 7:28 PM, Ali Çehreli
wrote:
> On 05/30/2014 08:30 AM, Russel Winder via Digitalmars-d-learn wrote:
>
>> enum double p0 = 0.0045;
>
> As others have already said, p0 is a manifest constant. Interestingly, it
> can be thought of like a C macro, being pasted inside so
On 05/30/2014 08:30 AM, Russel Winder via Digitalmars-d-learn wrote:
> enum double p0 = 0.0045;
As others have already said, p0 is a manifest constant. Interestingly,
it can be thought of like a C macro, being pasted inside source code.
Avoid enums for arrays and associative arrays a
A good use of 'static immutable', sadly not voted into the language.
:-)
But you're right, and I remember being tripped by this.
On Fri, May 30, 2014 at 07:17:15PM +0200, Philippe Sigaud via
Digitalmars-d-learn wrote:
> > In D enum can be used to define manifest constants. This means
> > constants known at compile time. In practice for a double there
> > isn't a lot of difference. In general you can't take the address of
>
> In D enum can be used to define manifest constants. This means constants
> known at compile time. In practice for a double there isn't a lot of
> difference. In general you can't take the address of a manifest constant,
> unlike immutables.
Because they do not exist as 'variables' or symbol in t
GDC version 4.8.2,i guess that's my problem. This is what happens
when you let Ubuntu look after your packages.
Thank you very much!
Andrew
On Friday, 30 May 2014 at 16:13:49 UTC, monarch_dodra wrote:
On Friday, 30 May 2014 at 13:39:18 UTC, Andrew Brown wrote:
Hi there,
The following code:
On Friday, 30 May 2014 at 13:39:18 UTC, Andrew Brown wrote:
Hi there,
The following code:
void main(){
import std.array : array;
import std.stdio : writeln;
import std.random : rndGen, randomShuffle;
import std.range : iota;
rndGen.seed(12);
int[] temp = iota(10).array;
ra
On Friday, 30 May 2014 at 15:30:15 UTC, Russel Winder via
Digitalmars-d-learn wrote:
I think I have no idea what D enums are about.
Bearophile's example of some code in an email on another thread
uses:
enum double p0 = 0.0045;
Now I would have written:
immutable double p0 =
Russel Winder:
For me, enum means create an enumerated type. Thus "enum
double" to define a single value is just a contradiction.
Enlightenment required…
In D enum can be used to define manifest constants. This means
constants known at compile time. In practice for a double there
isn't a l
I think I have no idea what D enums are about.
Bearophile's example of some code in an email on another thread uses:
enum double p0 = 0.0045;
Now I would have written:
immutable double p0 = 0.0045;
or at the very worst:
const double p0 = 0.0045;
For me, enum means cre
I'd like it to be predictable given the seed, right now it's
predictable given the seed and the compiler. Is this a bug,
shouldn't the random number process be completely defined in the
language?
I'm not trying to misuse it like the PHP crowd :) It's for a
piece of scientific software: I'm ho
Hi,
I'm try to encrypt a string with AES_cbc_encrypt using the
openssl bindings from
https://github.com/D-Programming-Deimos/openssl
And the result I got is wrong.
---
ubyte[32] key
// ...fill key
ubyte[16] iv;
// ...fill iv;
AES_KEY aes_key;
AES_set_encrypt_key(cast(const(ubyte)*)key.ptr,
I must note if the sequence is predictable, it's not random
anymore, it's pseudo-random at most.
Also, if anyone interested, PHP had such way to generate
predictable sequences in the past, but after it was horribly
misused by various people for crypto keys/password generation
purposes, they h
Hi there,
The following code:
void main(){
import std.array : array;
import std.stdio : writeln;
import std.random : rndGen, randomShuffle;
import std.range : iota;
rndGen.seed(12);
int[] temp = iota(10).array;
randomShuffle(temp);
writeln(temp);
}
writes [1, 8, 4, 2, 0
On Friday, 30 May 2014 at 12:57:52 UTC, anonymous wrote:
The "const" in the front is the same as the front in the back.
... the same as the "const" in the back
On Friday, 30 May 2014 at 12:35:46 UTC, francesco cattoglio wrote:
Today I got the following compile error:
"Cannot implicitly convert expression () of type
const() to "
and this is a reduced example ( also on
http://dpaste.dzfl.pl/f2f3bd921989):
module test;
import std.stdio;
class Foo {
On Friday, 30 May 2014 at 12:57:52 UTC, anonymous wrote:
And why is "const(Foo) getQ" so much different? (e.g: this is
an explicit cast, right? Is there anything that might go
wrong?)
It's not a cast. It's the unambiguous notation for a qualified
type. Often you can omit the parentheses. With
On Friday, 30 May 2014 at 12:35:46 UTC, francesco cattoglio wrote:
class MyClass {
[...]
const (Foo) getQ () const { return _Q; } // OK
// const Foo getQ () const { return _Q; } // fails
}
[...]
I don't really understand what's going on here. Why is "const
Foo getQ()" wrong?
francesco cattoglio:
And why is "const(Foo) getQ" so much different? (e.g: this is
an explicit cast, right?
In D the syntax for casts is "cast(something)somethingElse".
Bye,
bearophile
Today I got the following compile error:
"Cannot implicitly convert expression () of type
const() to "
and this is a reduced example ( also on
http://dpaste.dzfl.pl/f2f3bd921989):
module test;
import std.stdio;
class Foo {
int i = 42;
}
class MyClass {
private { Foo _Q;
On 5/30/2014 3:25 AM, Jeremy DeHaan wrote:
I know that we can use MSVC to build a 64 bit program, but is it also
possible to use it to build a 32 bit program as well?
If you mean using the MSVC toolchain with DMD, then the answer is no,
not at the moment. Rainer has done some work toward this,
40 matches
Mail list logo