Is there any convenient CopyMemory function in Phobos?

Jonathan M Davis jmdavisProg at gmx.com
Mon Jun 13 17:54:55 PDT 2011


On 2011-06-13 17:38, Andrej Mitrovic wrote:
> So why's it in core.stdc.string, instead of say.. core.memory?
> 
> Btw, I've had some imports already in the module and it seems these
> two conflict:
> 
> import core.thread;
> import core.stdc.string;
> 
> void main()
> {
>     int* p, x;
>     memcpy(p, x, 1);
> }
> 
> test.d(9): Error: core.stdc.string.memcpy at
> D:\DMD\dmd2\windows\bin\..\..\src\druntime\import\core\stdc\string.di(11)
> conflicts with core.thread.memcpy at
> D:\DMD\dmd2\windows\bin\..\..\src\druntime\import\core\thread.di(37)

core.thread has its own private declaration of memcpy (IIRC, they don't match 
for some reason). Why a private declaration conflicts, I don't know. That 
certainly _sounds_ like a bug. Regardless, I have no clue why those 
declarations are where they are. I would have expected something like 
core.memory, but they seem to be strewn about druntime. That should probably 
be improved. I just grepped druntime to find where memcpy's declaration was. I 
don't know why it is where it is.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list