[m-users.] Compiler warning in my readdir.m

Volker Wysk post at volker-wysk.de
Mon Oct 14 15:08:13 AEDT 2019


Hi

There might be an issue in my fixed version of readdir.m. When building
the module, I get a compiler warning:

Making Mercury/os/readdir.o
readdir.m: In function ‘readdir_module0’:
readdir.m:70:18: warning: assignment discards ‘const’ qualifier from
pointer target type [-Wdiscarded-qualifiers]
readdir.m: In function ‘readdir_module1’:
readdir.m:70:18: warning: assignment discards ‘const’ qualifier from
pointer target type [-Wdiscarded-qualifiers]

This is in the C code at this place (the line in the middle):

        if (errno == 0) {
           Entry = \"\";
           Result = 0;

I've attached the complete file.

Changing the 'Entry =' line to 'Entry = (char*) \"\"' avoids the
warning message. I guess it's not an error, but I'm not completely
sure. I'm not experienced with the foreign language interface (yet).
Maybe it's the type of "Entry" should be "char * const", rahter than
"char *".

Bye
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: readdir.m
Type: text/x-matlab
Size: 2361 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/users/attachments/20191014/361c2e7e/attachment.bin>


More information about the users mailing list