View mode: basic / threaded / horizontal-split · Log in · Help
April 02, 2005
conflicts?
What's the cleanest way to resolve this issue in D, suppose I need to import
both

import std.c.stdlib;
import std.string;

/dmd119/src/phobos/std/c/stdlib.d(53): function std.c.stdlib.atoi conflicts with
std.string.atoi at /dmd119/src/phobos/std/string.d(90)

/dmd119/src/phobos/std/c/stdlib.d(52): function std.c.stdlib.atof conflicts with
std.string.atof at /dmd119/src/phobos/std/string.d(95)

/dmd119/src/phobos/std/c/stdlib.d(53): function std.c.stdlib.atoi conflicts with
std.string.atoi at /dmd119/src/phobos/std/string.d(90)
April 03, 2005
Re: conflicts?
In article <d2na1q$18jc$1@digitaldaemon.com>, bug@d.com says...
>
>What's the cleanest way to resolve this issue in D, suppose I need to import
>both
>
>import std.c.stdlib;
>import std.string;

Yes, it's a fairly common issue.

>
>/dmd119/src/phobos/std/c/stdlib.d(53): function std.c.stdlib.atoi conflicts 
>with std.string.atoi at /dmd119/src/phobos/std/string.d(90)
>
>/dmd119/src/phobos/std/c/stdlib.d(52): function std.c.stdlib.atof conflicts 
>with std.string.atof at /dmd119/src/phobos/std/string.d(95)
>
>/dmd119/src/phobos/std/c/stdlib.d(53): function std.c.stdlib.atoi conflicts 
>with std.string.atoi at /dmd119/src/phobos/std/string.d(90)

You can either add an "alias" right after the import statements to define the
"default" atoi function for your program or fully specify which module you want
every time (i.e., "std.c.stdlib.atoi" or "std.string.atoi"). 

More details here:
http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.learn/238

jcc7
Top | Discussion index | About this forum | D home