Internationalization and localization tools


Locale-Sensitive Length Functions

int memcmp(const void *a1, const void *a2, size_t size);

int wmemcmp(const wchar_t *a1, const wchar_t *a2, size_t size);

int bcmp(const void *a1, const void *a2, size_t size);

Internationalization (I18n) Function Overview

The memcmp function compares the size bytes of memory beginning at a1 against the size bytes of memory beginning at a2. The value returned is smaller than or larger than zero depending on whether the first differing character in a1 is smaller or larger than the corresponding character in a2.

wmemcmp is the wide version of the function; its parameters are wide character strings and size is the number of wide characters, not bytes, to be compared.

bcmp is a deprecated alias for memcmp. Use memcmp instead.

I18n Issues

Care must be taken with the size parameter. For example, when transitioning from a singlebyte to a multibyte environment, make sure you are passing the number of bytes rather than the number of characters for the size parameter of memcmp.

Conversely, when transitioning from a singlebyte to a Windows Unicode environment, make sure you are passing the number of characters rather than the number of bytes for the size parameter of wmemcmp.

The memcmp and wmemcmp functions are mostly useful for testing equality. In particular, they should not be used for collation purposes, and a function designed specifically for collation should be used instead.

There is no Windows Generic function for memcmp.

Recommended Replacements*

*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.

Locale-Sensitive Length Functions

 

Lingoport internationalization and localization services and software