JDEdwards / Oracle EnterpriseOne - DIM Issues

DIM was introduced as a new macro for Unicode support. Similarly to sizeof it has some limitations, let's assume the following code:

void I5599999_TestFunction(JCHAR *szString)
  jdeStrncpyTerminate (szString, _J("ABCDEFG"), DIM(szString));

Although the jdeStrncpyTerminate looks correct, it is not. The variable szString is actually a pointer to a string and its DIM always returns 2, so the result would be "A" even if the string passed to the function can contain more JCHARs.

Resolution: Do not use DIM on pointers (typically in internal functions).

Back to Content

In case of any questions or suggestions please contact David Macek.