enum deviceType {cpu, gpu}
auto execDeviceSuffix = [deviceType.cpu:.cpu, deviceType.gpu:.gpu];
The way to get what you want to work in this case is to use a module
constructor. So, you'd do something like this:
string[deviceType] execDeviceSuffix;
static this()
{
Brad Roberts:
It's not by design. It's a quality of implementation issue that's solvable
given some time to work on it. I intend to, eventually, unless someone has
gotten to it ahead of me.
Good, I am glad to be wrong then.
Currently in LDC you have two different ways to tell the compiler
Tom:
Am I missing something or is this another major bug?
A major bug (that is not recognized as major, I think).
I don't remember its number in bugzilla, sorry (anyone remembers it?).
See also:
http://d.puremagic.com/issues/show_bug.cgi?id=4053
Bye,
bearophile
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article
On Monday, March 07, 2011 12:10:27 %u wrote:
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article
and add /path/to/unzipped/dmd2/linux/bin to your path.
how can i add path ?
Put it in the appropriate bashrc file
On 03/08/2011 09:26 AM, Wilfried Kirschenmann wrote:
enum deviceType {cpu, gpu}
auto execDeviceSuffix = [deviceType.cpu:.cpu, deviceType.gpu:.gpu];
The way to get what you want to work in this case is to use a module
constructor. So, you'd do something like this:
string[deviceType]
On Tuesday 08 March 2011 04:54:45 spir wrote:
On 03/08/2011 09:26 AM, Wilfried Kirschenmann wrote:
enum deviceType {cpu, gpu}
auto execDeviceSuffix = [deviceType.cpu:.cpu, deviceType.gpu:.gpu];
The way to get what you want to work in this case is to use a module
constructor. So, you'd
On 03/08/2011 03:48 PM, Jonathan M Davis wrote:
I really don't understand your problem with module constructors. They're
fantastic.
I may be wrong, but I think this point of view is a where I can from
statement. C's char* are fantastic when you have never used a PL with builtin
strings.
El 08/03/2011 05:32, bearophile escribió:
Tom:
Am I missing something or is this another major bug?
A major bug (that is not recognized as major, I think).
I don't remember its number in bugzilla, sorry (anyone remembers it?).
See also:
http://d.puremagic.com/issues/show_bug.cgi?id=4053
I really don't understand your problem with module constructors. They're
fantastic.
I may be wrong, but I think this point of view is a where I can from
statement. C's char* are fantastic when you have never used a PL with
builtin strings. There are languages in which you don't need to list
On Tue, 08 Mar 2011 10:52:38 -0500, Tom t...@nospam.com wrote:
El 08/03/2011 05:32, bearophile escribió:
Tom:
Am I missing something or is this another major bug?
A major bug (that is not recognized as major, I think).
I don't remember its number in bugzilla, sorry (anyone remembers it?).
El 08/03/2011 13:05, Steven Schveighoffer escribió:
On Tue, 08 Mar 2011 10:52:38 -0500, Tom t...@nospam.com wrote:
El 08/03/2011 05:32, bearophile escribió:
Tom:
Am I missing something or is this another major bug?
A major bug (that is not recognized as major, I think).
I don't remember
Hi,
When running the following file:
#!../dmd2/linux/bin/rdmd -unittest
import std.string, std.traits;
void main(string[] args){
bool test = isNumeric(args[0]);
}
I get the error :
dmd2/linux/bin/../../src/phobos/std/traits.d(2576): Error: template
std.traits.isNumeric(T) is not a
import std.stdio;
import std.traits;
import std.exception;
struct CheckedInt(N) if (isIntegral!N)
{
private N value;
ref CheckedInt opUnary(string op)() if (op == ++)
{
enforce(value != value.max);
++value;
return this;
}
this(N _value)
{
On Tue, 08 Mar 2011 12:06:08 -0500, Andrej Mitrovic n...@none.none wrote:
import std.stdio;
import std.traits;
import std.exception;
struct CheckedInt(N) if (isIntegral!N)
{
private N value;
ref CheckedInt opUnary(string op)() if (op == ++)
{
enforce(value != value.max);
On 03/08/2011 08:24 AM, Wilfried Kirschenmann wrote:
Hi,
When running the following file:
#!../dmd2/linux/bin/rdmd -unittest
import std.string, std.traits;
void main(string[] args){
bool test = isNumeric(args[0]);
}
I get the error :
module test;
struct MyArray(T)
{
private T[] data;
bool opCast(T)() if (is(T == bool))
{
return !data.empty;
}
}
void main()
{
auto foo = MyArray!(int)();
auto state = foo ? true : false;
}
test.d(13): Error: undefined identifier module test.empty
Nevermind, I'm dumb. It's in std.array, I just need to import it. This needs to
be said in TDPL however.
Steven Schveighoffe:
Those two bugs look almost identical, I think they should be combined...
Right, they look similar. I have linked each with the other, so if one gets
fixed it's very easy to see if the fix fixes the other too. One bug has 4 votes
and one bug 1 vote.
Bye,
bearophile
On 3/8/11, bearophile bearophileh...@lycos.com wrote:
empty is not an array method, it's a free function that is used with a
funny syntax.
Yes but the compiler doesn't know that until std.array is imported. A
better error message is that empty isn't a property of that array.
It's much easier to
Andrej Mitrovic Wrote:
On 3/8/11, bearophile bearophileh...@lycos.com wrote:
empty is not an array method, it's a free function that is used with a
funny syntax.
Yes but the compiler doesn't know that until std.array is imported. A
better error message is that empty isn't a property of
On 3/8/11, Jesse Phillips jessekphillip...@gmail.com wrote:
What if you are trying to create a method which will act as a property for
the array? If you get it wrong you would get the error that an array doesn't
have the property and scream, I know that is why I'm building a function
for it.
On 03/08/2011 06:20 PM, Steven Schveighoffer wrote:
On Tue, 08 Mar 2011 12:06:08 -0500, Andrej Mitrovic n...@none.none wrote:
import std.stdio;
import std.traits;
import std.exception;
struct CheckedInt(N) if (isIntegral!N)
{
private N value;
ref CheckedInt opUnary(string op)() if (op == ++)
On 03/08/2011 06:56 PM, Andrej Mitrovic wrote:
module test;
struct MyArray(T)
{
private T[] data;
bool opCast(T)() if (is(T == bool))
{
return !data.empty;
}
}
void main()
{
auto foo = MyArray!(int)();
auto state = foo ? true : false;
}
test.d(13):
On 3/8/11 8:20 PM, spir wrote:
[…] Yet another
syntactic special-case for special cases in the language. In this case,
there are even 3 ways to write the same thing: […]
I don't quite get how you think this would be a syntactic special case.
As Steve pointed out, »class Foo(T) {}« is merely
On Tue, 08 Mar 2011 14:20:40 -0500, spir denis.s...@gmail.com wrote:
On 03/08/2011 06:20 PM, Steven Schveighoffer wrote:
On Tue, 08 Mar 2011 12:06:08 -0500, Andrej Mitrovic n...@none.none
wrote:
import std.stdio;
import std.traits;
import std.exception;
struct CheckedInt(N) if
On 08.03.2011 01:32, Andrej Mitrovic wrote:
Sorry for not seeing this sooner. I think you might have set the wrong
calling convention in the translated header file. See my answer on SO.
I hope it works for you now.
Thanks. Just to get the solution here too:
* Use the vs2005 library (to get
David Nadlinger:
and because of this, it would rather
be a special case *not* to allow referring to Foo using just that name.
Right. On the other hand the current straightforward design leads to some bugs
too, the give bad error messages:
http://d.puremagic.com/issues/show_bug.cgi?id=3950
Ali Çehreli acehr...@yahoo.com wrote in message
news:il5pge$nrr$1...@digitalmars.com...
On 03/08/2011 08:24 AM, Wilfried Kirschenmann wrote:
Hi,
When running the following file:
#!../dmd2/linux/bin/rdmd -unittest
import std.string, std.traits;
void main(string[] args){
bool test
Andrej Mitrovic Wrote:
On 3/8/11, Jesse Phillips jessekphillip...@gmail.com wrote:
What if you are trying to create a method which will act as a property for
the array? If you get it wrong you would get the error that an array doesn't
have the property and scream, I know that is why I'm
import std.stdio;
struct S {
int i;
int j;
}
int main(string[] args) {
S[] ss = void;
ss.length = 5;
foreach (ref s; ss)
s = S(1, 2);
return 0;
}
Is the above code correct? (it doesn't work... it blows away or just
give and
On 03/08/2011 01:34 PM, Tom wrote:
import std.stdio;
struct S {
int i;
int j;
}
int main(string[] args) {
S[] ss = void;
ss.length = 5;
foreach (ref s; ss)
s = S(1, 2);
return 0;
}
Is the above code correct? (it doesn't work... it blows away or just
give and access violation error).
I need
On Tue, 08 Mar 2011 16:53:08 -0500, Ali Çehreli acehr...@yahoo.com wrote:
On 03/08/2011 01:34 PM, Tom wrote:
import std.stdio;
struct S {
int i;
int j;
}
int main(string[] args) {
S[] ss = void;
ss.length = 5;
foreach (ref s; ss)
s = S(1, 2);
return 0;
}
Is the above code correct? (it
On 03/08/2011 02:03 PM, Steven Schveighoffer wrote:
it's not std.array.reserve, it's object.reserve, always present, no need
to import.
Thanks. The reserve that I found in array.d is
std.array.Appender(T).reserve.
Ali
El 08/03/2011 19:03, Steven Schveighoffer escribió:
On Tue, 08 Mar 2011 16:53:08 -0500, Ali Çehreli acehr...@yahoo.com wrote:
On 03/08/2011 01:34 PM, Tom wrote:
import std.stdio;
struct S {
int i;
int j;
}
int main(string[] args) {
S[] ss = void;
ss.length = 5;
foreach (ref s; ss)
s = S(1,
On Tue, 08 Mar 2011 17:48:37 -0500, Tom t...@nospam.com wrote:
http://d.puremagic.com/issues/show_bug.cgi?id=5603
This is really sad. This kind of stuff is a must for performance. D is
disappointing me too much yet :(
There is always c's malloc, or you can try using the GC malloc
Well, maybe one day we'll have a compiler with lots of front-end
customization options (or some nice analysis tools). In any case this
topic is done here since post #2. :)
On 3/8/11, Steven Schveighoffer schvei...@yahoo.com wrote:
See the problem?
Yup. Btw, does auto ref still suffer from any bugs that I should know
about? I've heard it had issues.
On Tuesday, March 08, 2011 07:40:08 spir wrote:
On 03/08/2011 03:48 PM, Jonathan M Davis wrote:
I really don't understand your problem with module constructors. They're
fantastic.
I may be wrong, but I think this point of view is a where I can from
statement. C's char* are fantastic when
On Tuesday, March 08, 2011 13:24:44 Nick Sabalausky wrote:
Ali Çehreli acehr...@yahoo.com wrote in message
news:il5pge$nrr$1...@digitalmars.com...
On 03/08/2011 08:24 AM, Wilfried Kirschenmann wrote:
Hi,
When running the following file:
#!../dmd2/linux/bin/rdmd -unittest
On Tuesday, March 08, 2011 16:11:09 Jonathan M Davis wrote:
On Tuesday, March 08, 2011 13:24:44 Nick Sabalausky wrote:
Ali Çehreli acehr...@yahoo.com wrote in message
news:il5pge$nrr$1...@digitalmars.com...
On 03/08/2011 08:24 AM, Wilfried Kirschenmann wrote:
Hi,
When
On Tuesday, March 08, 2011 15:31:37 Andrej Mitrovic wrote:
On 3/8/11, Steven Schveighoffer schvei...@yahoo.com wrote:
See the problem?
Yup. Btw, does auto ref still suffer from any bugs that I should know
about? I've heard it had issues.
I'm not sure that it works correctly with properties
On 03/08/2011 02:34 PM, Tom wrote:
import std.stdio;
struct S {
int i;
int j;
}
int main(string[] args) {
S[] ss = void;
ss.length = 5;
foreach (ref s; ss)
s = S(1, 2);
return 0;
}
Is the above code correct? (it doesn't work... it blows away or just
give and access violation error).
I need
On 03/08/2011 05:42 PM, Kai Meyer wrote:
On 03/08/2011 02:34 PM, Tom wrote:
import std.stdio;
struct S {
int i;
int j;
}
int main(string[] args) {
S[] ss = void;
ss.length = 5;
foreach (ref s; ss)
s = S(1, 2);
return 0;
}
Is the above code correct? (it doesn't work... it blows away or just
El 08/03/2011 21:42, Kai Meyer escribió:
On 03/08/2011 02:34 PM, Tom wrote:
import std.stdio;
struct S {
int i;
int j;
}
int main(string[] args) {
S[] ss = void;
ss.length = 5;
foreach (ref s; ss)
s = S(1, 2);
return 0;
}
Is the above code correct? (it doesn't work... it blows away or just
On 3/8/2011 12:57 PM, simendsjo wrote:
One more thing..
Function pointers in structs.. Should they use extern(Windows) too?
Yes.
Kai Meyer Wrote:
gcc -m32 -shared -fPIC Test.cpp -o libTest.so
So I monkeyed around a little bit, and found out that if I change
extern (C) to extern (C++), the library links correctly and the
program runs.
That lead me to believe that if I added the -cpp option to htod.exe,
it would
46 matches
Mail list logo