Note that there are some explanatory texts on larger screens.

plurals
  1. USwildplasser
    primarykey
    data
    text
    plurals
    1. COqsort is a nasty beast. It accepts one base pointer, an element size, and the count of elements plus a compare function needed to compare two elements, passed to it by pointers. There is a contract between the caller and qsort, that the compare function actually takes the elements of the given type. (we've all been bitten by that ;-) Given the (void*) pointers, the casting is never necessary, but it will become necessairy if some dereferencing has to take place. It is a programmer's choice to put the dereferencing at the right place. But it basically still is a matter of taste or style, IMHO.
      singulars
    2. COI am very afraid. The real pathway for porting "legacy" C code to something different would be to first hoist it to c89/ANSI standards: fix the prototyping, take a look at the typing and sizes, etc. Also, you got to get to know the code: what kind of idiom does it use: casts, struct hack, pointer tricks, preprocessor magic, ... But putting a C++ kid on such a project is a recipe for disaster, IMHO.
      singulars
    3. COBut truncated utf8 strings are not valid. And unterminated strings are wrong in both cases. strncpy is worse than the problems it tries to solve. BTW: even if you "solve" the problem and produce a valid and terminated utf8 (or plain ascii) string, it is still truncated. What is the semantic value of the first xxx characters of a string? The program does not crash, but do you really want its results?
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload