www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - conflicts?

reply bug d.com writes:
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)
Apr 02 2005
parent J C Calvarese <technocrat7 gmail.com> writes:
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: digitalmars.D.learn/238 jcc7
Apr 02 2005