[LLVMdev] Building lld with Visual Studio 2012 RC

Marshall Clow mclow.lists at gmail.com
Sat Jun 16 21:14:48 PDT 2012


On Jun 16, 2012, at 4:15 PM, Cesar Mello wrote:

> Hi!
> 
> I'm trying to build lld Microsoft Visual Studio 2012 RC, but it seems the bzero function is not available.
> 
> Could memset be used instead of bzero? Or maybe define a bzero for msvc using memset.
> 
> For example:
> 
>       // in-memory matches on-disk, so copy first fields followed by path
>       ::memcpy(to, (uint8_t*)&cmd, 12);
>       ::memcpy(&to[12], _name.data(), _name.size());
>       ::bzero(&to[12+_name.size()], cmdsize-(12+_name.size()));
> 
> The bzero line could be changed to:
> 
> 	  ::memset(&to[12+_name.size()], 0, cmdsize-(12+_name.size()));
> 
> Thanks a lot for the attention and congratulations for the great work!!!

I would be sorely tempted to just do the memset first:

      ::memset(to, 0, cmdsize);
      ::memcpy(to, (uint8_t*)&cmd, 12);
      ::memcpy(&to[12], _name.data(), _name.size());

Easy to understand, easy to convince yourself that it is correct, and slightly slower at runtime.


-- Marshall

Marshall Clow     Idio Software   <mailto:mclow.lists at gmail.com>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki





More information about the llvm-dev mailing list