Truly Portable C Applications
12 points by signa11 9 hours ago | 2 comments
  • p0w3n3d 2 hours ago |
    I have learned there is no true portability. Example: named pipes:

    I started my professional career as a C++/Qt developer. There was this code to disallow multiple application instances using named pipes. It used named pipes under both Linux and Windows - just create a named pipe "my-program-pipe" and it was a signal for other starting up instances to communicate to it "please put the main app on top" and close.

    On linux it worked like a charm. On Windows it worked like a charm...

    ...only first time. The code was written to "try create a named pipe and if failed - then it means it exists, so write to it instead and exit". This "try create" operation on windows failed but also removed the original existing pipe, thus allowing the third instance to coexist with the first one.

    What I mean - Operating Systems are more than this, you cannot write a truly portable application without knowing them all. And especially those quirks that differ...

  • 100ideas an hour ago |
    Very interesting comments and moderation discussion on this article.