Go to the C standard library (7) -- & quot; string. h & quot; To implement functions such as memcmp, memcpy, memmove, and memset.

Source: Internet
Author: User

My memcmp:

  memcmp( *buf1,  *buf2, unsigned           (count && !(reval = (*(unsigned  *)buf1) - (*(unsigned  *          buf1 = (unsigned  *)buf1 +          buf2 = (unsigned  *)buf2 +          --       }

VC MS:

  *  * (!( ( --count && *( *)buf1 == *( *= ( *)buf1 + = ( *)buf2 + ( *((unsigned  *)buf1) - *((unsigned  *

The const void * buf should be used properly, and the contents of the block memory should not be changed. Finally, the unsigned char * should be used for calculation to ensure that the symbols of the calculation result are correct.

 

My memcpy:

  *memcpy( *dest,   *src, unsigned       *reval =     (count--          (*(unsigned  *)dest++) = (*(unsigned  *)src++       }

MSVC:

  *          *           *             * ret =   defined (_M_MRX000) || defined (_M_ALPHA) || defined (_M_PPC)            RtlMoveMemory(  *,   *      /* defined (_M_MRX000) || defined (_M_ALPHA) || defined (_M_PPC) */                              (count--                 *( *)dst = *( *                 dst = ( *)dst +                  src = ( *)src +     /* defined (_M_MRX000) || defined (_M_ALPHA) || defined (_M_PPC) */           }

 

My memmove:

  *memmove( *dest,   *src, unsigned       *reval =      overlap = ((unsigned  *)src < (unsigned  *)dest && ((unsigned  *)src + count) >     (count--         (overlap)               (*((unsigned  *)dest + count)) = (*((unsigned  *)src + count                      (*(unsigned  *)dest++) = (*(unsigned  *)src++       }

MSVC:

  *          *           *             * ret =   defined (_M_MRX000) || defined (_M_ALPHA) || defined (_M_PPC)            RtlMoveMemory(  *,   *      /* defined (_M_MRX000) || defined (_M_ALPHA) || defined (_M_PPC) */          (dst <= src || ( *)dst >= (( *)src +                                                       (count--                         *( *)dst = *( *                         dst = ( *)dst +                          src = ( *)src +                                                                  dst = ( *)dst + count -                  src = ( *)src + count -                    (count--                         *( *)dst = *( *                         dst = ( *)dst -                          src = ( *)src -      /* defined (_M_MRX000) || defined (_M_ALPHA) || defined (_M_PPC) */           }

Regarding the differences between memcpy and memmove, memcpy does not consider the overlap of memory areas, while memmove ensures that memory areas overlap and replication can be successful.

Sometimes our memcpy may be used normally when the memory overlaps. This depends on its implementation and is not universal. This is not required in the C language standard.

References:

Differences between memcpy and memmove Functions

Http://blog.csdn.net/caowei840701/article/details/8491836

Memcpy () vs memmove ()

Http://stackoverflow.com/questions/4415910/memcpy-vs-memmove

 

My memset:

  *memset( *buffer,  c,       *reval =     (count--         (*(unsigned  *)buffer++) = (unsigned        }

MSVC:

  *          *                      *start =   defined (_M_MRX000) || defined (_M_ALPHA) || defined (_M_PPC)            RtlFillMemory(  *, size_t count,           RtlFillMemory( dst, count, (    /* defined (_M_MRX000) || defined (_M_ALPHA) || defined (_M_PPC) */          (count--                 *( *)dst = (                 dst = ( *)dst +     /* defined (_M_MRX000) || defined (_M_ALPHA) || defined (_M_PPC) */           }

 

End

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.