-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
carrays and warning on char / char* #1132
Comments
On 23 October 2017 at 10:09, jleni ***@***.***> wrote:
Swig documentation says that array_class() should not be used with char or
char *.
http://www.swig.org/Doc3.0/Library.html#Library_carrays
Note: %array_functions() and %array_class() should not be used with types
of char or char *.
The reason is not explicit in the documentation. Could someone explain the
reason? Should the documentation be updated?
Is this to avoid collisions with strings?
Yes, the default handling for char and char * is for character strings and
the macros do not do enough to change this.
Try the following to modify the default handling to treat char as a number
and char pointers/arrays as a regular pointer. The two macros should then
work for char and char *, but you'll break normal usage for char * as
strings.
%apply signed char {char}
%apply SWIGTYPE* {char *, char[ANY], char []}
Is it ok to use array_class with unsigned char * ?
It should be.
William
|
@wsfulton Is there something you think should be addressed in SWIG here, or can this be closed? |
8e733c0 enhanced the docs. Closing. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Swig documentation says that array_class() should not be used with char or char *.
http://www.swig.org/Doc3.0/Library.html#Library_carrays
Note: %array_functions() and %array_class() should not be used with types of char or char *.
The reason is not explicit in the documentation. Could someone explain the reason? Should the documentation be updated?
Is this to avoid collisions with strings? Is it ok to use array_class with unsigned char * ?
The text was updated successfully, but these errors were encountered: