Professional Web Applications Themes

portable C code? - UNIX Programming

Hi everyone, I'm wondering how to tell if C code is potable across platforms (without actually having that platform)? I'm looking at some network code for Linux, and wondering if it'll run on VMS and win32. The code is here: http://groups.google.com/groups?selm=3c9a69a1%241_1%40dnews&oe=UTF-8&output=gplain In particular, is sendto() and recvfrom() portable? Thanks. Andreas R....

  1. #1

    Default portable C code?

    Hi everyone,

    I'm wondering how to tell if C code is potable across platforms (without
    actually having that platform)?
    I'm looking at some network code for Linux, and wondering if it'll run on
    VMS and win32.

    The code is here:
    http://groups.google.com/groups?selm=3c9a69a1%241_1%40dnews&oe=UTF-8&output=gplain

    In particular, is sendto() and recvfrom() portable?

    Thanks.

    Andreas R.

    Andreas Guest

  2. #2

    Default Re: portable C code?

    Andreas Røsdal <ntnu.no> writes:
     

    man sendto
    man recvfrom

    (Section "CONFORMING TO").

    --
    __Pascal_Bourguignon__
    http://www.informatimago.com/
    Pascal Guest

  3. #3

    Default Re: portable C code?

    Not I sort of understand what that section is for :-)
    What should you look for if you want the function to work under Windows?
    win32? posix?


    C3
     



    C3 Guest

  4. #4

    Default Re: portable C code?

    Bitter experience has told me that no matter how carefully you
    program, you *must* test on all target platforms. There's
    always some kind of GOTCHA just waiting to jump on the
    unsuspecting programmer. For example, in order to get any
    socket functions to work on Windows, you must first call WSAStartup().
    So, having said that, find some test platforms somehow. You'll
    never be sure that your code works until you try it on the
    target platform.

    --

    Fletcher Glenn

    Andreas Røsdal wrote: 

    Fletcher Guest

  5. #5

    Default Re: portable C code?

    On Mon, 27 Oct 2003 21:59:22 +1100, C3 wrote:

    [top-posting fixed]
     [/ref]
     

    Either ANSI or ISO.
     

    Please post your reply UNDER the text you are replying to.

    Mac
    --
    Mac Guest

  6. #6

    Default Re: portable C code?

    "Andreas Røsdal" <ntnu.no> wrote in message
    news:stud.ntnu.no... 
    If your code is conforming to (C) Standard on one conforming platform,
    it should be portable to any platform conforming to same standard, IMHO.
    So determine those 3 factors, and math will be easy.
     
    http://groups.google.com/groups?selm=3c9a69a1%241_1%40dnews&oe=UTF-8&output=gplain 
    AFAIK they are not part of standard C, so there is high probability
    that your code is not portable. Especially to Windoze, with winsocks
    interface.


    nobody Guest

  7. #7

    Default Re: portable C code?

    I have network code that works under Windows (Microsoft Visual C++ 6, and
    ..NET, and .NET 2003, and cygwin), linux, several unices, and VMS. It
    takes several macros and #ifdefs to make the magic happen. The chances of
    something properly doing network code cross-platform, which was written
    for one specific platform, are as close to nil as to make no difference.


    --
    #include <standard.disclaimer>
    _
    Kevin D Quitt USA 91387-4454 96.37% of all statistics are made up
    Per the FCA, this address may not be added to any commercial mail list
    Kevin Guest

Similar Threads

  1. OT: Portable Storage
    By Paul G Elson in forum Adobe Photoshop Mac CS, CS2 & CS3
    Replies: 0
    Last Post: April 9th, 04:18 PM
  2. portable IPC - Win and Linux?
    By Tom Jones in forum PHP Development
    Replies: 2
    Last Post: November 19th, 01:34 PM
  3. LAN, NetInfo and a portable
    By Sandman in forum Mac Applications & Software
    Replies: 0
    Last Post: July 7th, 09:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139