You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My installation of Linux has the following prototype for scandir:
externintscandir (constchar*__restrict __dir,
structdirent***__restrict __namelist,
int (*__selector) (conststructdirent*),
int (*__cmp) (conststructdirent**,
conststructdirent**))
The difference between void (your dirent) and dirent (Linux) pointers for compare causes problems in our project. Depending on the enabled warnings, you can't even pass alphasort (which uses dirent pointers in your code) to scandir. A Visual Studio warning recommends to cast it, and that includes the __cdecl convention - a macro which does not exist on other compilers.
So people patch this code for Visual Studio and by adding the cast, they break other platforms.
This cast should not be necessary in the first place - why is the prototype like this?
Can the prototype in your dirent.h be changed to use dirent pointers (on this repo)?
The text was updated successfully, but these errors were encountered:
My installation of Linux has the following prototype for
scandir
:The difference between
void
(your dirent) anddirent
(Linux) pointers forcompare
causes problems in our project. Depending on the enabled warnings, you can't even passalphasort
(which usesdirent
pointers in your code) toscandir
. A Visual Studio warning recommends to cast it, and that includes the__cdecl
convention - a macro which does not exist on other compilers.So people patch this code for Visual Studio and by adding the cast, they break other platforms.
This cast should not be necessary in the first place - why is the prototype like this?
Can the prototype in your
dirent.h
be changed to usedirent
pointers (on this repo)?The text was updated successfully, but these errors were encountered: