thanks!
"Etherous" wrote in message news:is8dbh$n22$1...@digitalmars.com...
You need to set it in a static constructor
immutable string[int] MyDict;
static this ()
{
MyDict = cast(string[int]) [
1: "monday",
2: "tuesday"
];
}
what if the Win32 function I'm interested in don't seem to be in .lib
provide by dmd...
(for example vista & up windows function)
Can I just use the .lib which come from the windows SDK?
If you have coffimplib (which isn't free), then you could just convert
the windows sdk import lib to OMF format.
Otherwise, you can create an import library from a DLL.
Find the DLL (e.g. kernel32.dll), and run:
implib /s kernel32.lib kernel32.dll
Then link with the new import lib. I think that
maybe it's late, or I have a hard time reading the string and array class
methods.. (which I have! :~)
anyway, I have a very simple problem and it seems hard to fix!
let say I have a list of resource named preferential order (favored first)
and I'd like to do return a list of match in preferent
test case:
import std.algorithm;
void main()
{
float[10] arr;
arr[] = 0.0;
map!((ref float sample){ sample = 1.0; })(arr[]);
}
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(382): Error: nan is
not an lvalue
This looks like a bug to me?
I did the following, what do you think of my implementation?
(checking if my string and array usage could be improved / powered
up!!!)
string[] _locales = ["en-AU", "fr-FR"];
string getCurrentLocal() { return "fr-BE"; }
string[] getCandidates()
{
auto local = getCurrentLocal();
strin
Thanks I'll try tomorrow! :)
(now I should really go to bed...)
"Andrej Mitrovic" wrote in message
news:mailman.565.1307117174.14074.digitalmars-d-le...@puremagic.com...
If you have coffimplib (which isn't free), then you could just convert
the windows sdk import lib to OMF format.
Otherwise
Offending line in map:
alias typeof(_fun(.ElementType!R.init)) ElementType;
So it tires to pass .init which will be nan for floats.
A quick workaround would be:
static if (isFloatingPoint!(ElementType!R))
{
.ElementType!R x;
alias typeof(_fun(x)) ElementType;
}
els
Ugh don't I love making silly posts like these. ref won't work for any
types, not just floats, since it uses the .init property.
My real problem was that I was using assignment in my first example
instead of returning a value. Using map with ref doesn't make much
sense. So my complaints are void.
Andrej Mitrovic:
> A quick workaround would be:
> static if (isFloatingPoint!(ElementType!R))
> {
> .ElementType!R x;
> alias typeof(_fun(x)) ElementType;
> }
> else
> {
> alias typeof(_fun(.ElementType!R.init)) ElementType;
> }
If you have improvem
On 06/03/2011 10:15 AM, Andrej Mitrovic wrote:
> Offending line in map:
> alias typeof(_fun(.ElementType!R.init)) ElementType;
The fact that the error points at that line should be a bug. That's just
an alias, nothing is evaluated at that line.
Ali
Lloyd Dupont:
> I did the following, what do you think of my implementation?
Those for loops seem better as foreach ones, or even reverse foreach ones.
Probably in std.algorithm there is stuff to shorten your code.
Bye,
bearophile
On 2011-06-03 09:55, Lloyd Dupont wrote:
> I did the following, what do you think of my implementation?
> (checking if my string and array usage could be improved / powered
> up!!!)
>
> string[] _locales = ["en-AU", "fr-FR"];
> string getCurrentLocal() { return "fr-BE"; }
> string[] getCandida
std.algorithm!
will have a look, thanks!
"bearophile" wrote in message news:isb5ql$1i23$1...@digitalmars.com...
Lloyd Dupont:
I did the following, what do you think of my implementation?
Those for loops seem better as foreach ones, or even reverse foreach ones.
Probably in std.algorithm t
Where can I find this "implib" tool you mentioned?
I have the latest Windows SDK and Visual Studio 2010. Yet when I perform a
search in program files I can't find it!!
:(
"Andrej Mitrovic" wrote in message
news:mailman.565.1307117174.14074.digitalmars-d-le...@puremagic.com...
If you have c
http://ftp.digitalmars.com/bup.zip
Docs here:
http://www.digitalmars.com/ctg/implib.html
On Thu, Jun 2, 2011 at 11:55 PM, Jonathan M Davis wrote:
> I don't really like the idea of private functions being virtual
> by default though, so maybe your suggestion would be a good one.
Speaking as a newbie with very little D experience, the idea of
private functions being non-virtual would m
On 2011-06-03 11:13, Michael Shulman wrote:
> On Thu, Jun 2, 2011 at 11:55 PM, Jonathan M Davis
wrote:
> > I don't really like the idea of private functions being virtual
> > by default though, so maybe your suggestion would be a good one.
>
> Speaking as a newbie with very little D experience,
On Fri, Jun 3, 2011 at 11:22 AM, Jonathan M Davis wrote:
>> However, given that in D, 'private' only means restricted to a
>> *module*, it's less clear to me why private functions should be
>> singled out as non-virtual. I might want certain methods to be
>> accessible only within a given module,
On 2011-06-03 11:59, Michael Shulman wrote:
> On Fri, Jun 3, 2011 at 11:22 AM, Jonathan M Davis
wrote:
> >> However, given that in D, 'private' only means restricted to a
> >> *module*, it's less clear to me why private functions should be
> >> singled out as non-virtual. I might want certain met
I made the Following change to backend/elfobj.c
I have no idea what I just did but it has solved my problem
Could anyone explain?
-- align16.patch --
diff --u a/src/backend/elfobj.c b/src/backend/elfobj.c
--- a/src/backend/elfobj.c
+++ b/src/backend/elfobj.c
@@ -683,7 +683,7 @@ void obj_init(Outb
I can't find any timers in phobos, basically I want some loop to run for a
predetermined amount of time. Currently I use this:
import core.time;
import std.datetime;
import core.thread;
void main()
{
auto finalTime = Clock.currTime + dur!"seconds"(4);
while (true)
{
Thre
On 2011-06-03 14:22, Andrej Mitrovic wrote:
> I can't find any timers in phobos, basically I want some loop to run for a
> predetermined amount of time. Currently I use this:
>
> import core.time;
> import std.datetime;
> import core.thread;
>
> void main()
> {
> auto finalTime = Clock.currTime +
On 6/3/11, Jonathan M Davis wrote:
>
> Generally, you'd just put it to sleep for the period of time that you want
> to
> wait for. The only reason that I see to keep waking it up is if it could be
> interrupted and effectively told to wake up - in which case you would be
> sleeping and waking up o
On Fri, Jun 3, 2011 at 1:02 PM, Jonathan M Davis wrote:
> And if you don't know about NVI, having a
> virtual private function is just plain weird.
Well, it makes perfect sense to me, once given that in D, 'private'
allows access from anywhere in the same module, rather than only in
the defining
On 2011-06-03 14:37, Andrej Mitrovic wrote:
> On 6/3/11, Jonathan M Davis wrote:
> > Generally, you'd just put it to sleep for the period of time that you
> > want to
> > wait for. The only reason that I see to keep waking it up is if it could
> > be interrupted and effectively told to wake up - i
I didn't even think about issue #1. Thanks again!
On 2011-06-03 14:55, Michael Shulman wrote:
> On Fri, Jun 3, 2011 at 1:02 PM, Jonathan M Davis
wrote:
> > And if you don't know about NVI, having a
> > virtual private function is just plain weird.
>
> Well, it makes perfect sense to me, once given that in D, 'private'
> allows access from anywh
Sweet, thanks you very much! :)
"Andrej Mitrovic" wrote in message
news:mailman.573.1307123755.14074.digitalmars-d-le...@puremagic.com...
http://ftp.digitalmars.com/bup.zip
Docs here:
http://www.digitalmars.com/ctg/implib.html
On Fri, Jun 3, 2011 at 3:07 PM, Jonathan M Davis wrote:
> I'd suggest opening a bug report.
Okay, will do.
> Regardless, I would have hoped that you'd get an error at compile
> time about overriding a non-virtual function if package is
> non-virtual
It appears that overriding a non-virtual, non
The bug report appears to already exist:
http://d.puremagic.com/issues/show_bug.cgi?id=3258
On Fri, Jun 3, 2011 at 3:07 PM, Jonathan M Davis wrote:
> On 2011-06-03 14:55, Michael Shulman wrote:
>> On Fri, Jun 3, 2011 at 1:02 PM, Jonathan M Davis
> wrote:
>> > And if you don't know about NVI, hav
On 2011-06-03 19:44, Michael Shulman wrote:
> On Fri, Jun 3, 2011 at 3:07 PM, Jonathan M Davis
wrote:
> > I'd suggest opening a bug report.
>
> Okay, will do.
>
> > Regardless, I would have hoped that you'd get an error at compile
> > time about overriding a non-virtual function if package is
>
On Fri, Jun 3, 2011 at 8:54 PM, Jonathan M Davis wrote:
> Try to compile with -w. My guess is that you will get a compiler error.
Nope.
On 2011-06-03 21:52, Michael Shulman wrote:
> On Fri, Jun 3, 2011 at 8:54 PM, Jonathan M Davis
wrote:
> > Try to compile with -w. My guess is that you will get a compiler error.
>
> Nope.
Then file a bug report on it. As I understand it, overriding a non-virtual
function in D should be illegal
34 matches
Mail list logo