Two structures, bunch of programs.

Ask a Question related to UNIX Programming, Design and Development.

  1. #1

    Default Two structures, bunch of programs.

    Hello,

    What is the best method to do the following:

    Let's say two programs use the same data structure. Each one of them keeps
    all the function prototypes and other structures in header files.
    Some functions have the same name but take different parameters, so i cant
    include first programs header file in the second program (unless i #ifdef).

    What is the best aproach to use the same data structure used by 2 or more
    programs?
    Put the structure used by both programs it in a seperate header file, so
    if it changes i wouldnt have to change it in 2 or more sources?
    Or use #ifdef .. #endif?

    Or any other method?


    P.Krumins
    Peteris Krumins Guest

  2. Similar Questions and Discussions

    1. HELP: Loading bunch of swf(movies) with XML
      Hello, I used a sample of macromedia to get a XML file with the names to the swf files i want to import in the stage. That works (for now). But...
    2. Can't open administrator, get bunch of binary codesinstead. Please help!
      Hello all, I have installed Cold Fusion 6.1 in a Fedora machine and CF admin doesn't want to show up. Instead I see the bunch of characters below....
    3. How can I drag several clips as a bunch. URGENT
      I want to drag several movie clips a one. StartDrag won't do it as it drags only one mc at a time. Is there a way to group them so that when you...
    4. Lost a bunch of data, looking for advice
      Thanks Ian. We DL'd the trial version, and I think it's going to work out for us. It's processing an UNDO SQL statement right now. -corky Ian...
    5. - How do I copy a bunch of bookmarks into an email body?
      Just do an Export. It will make a file Bookmark.html . -- ----- Paul ----- www.paulsxp.com www.paulsxp.com/forums "The Cerebral Ass ©"...
  3. #2

    Default Re: Two structures, bunch of programs.

    Peteris Krumins wrote in article
    <Xns93BB13C4FC04Awhitesuneapollolv@130.133.1.4> on Thursday 17 July 2003
    00:57 in comp.unix.programmer:
    > What is the best aproach to use the same data structure used by 2 or more
    > programs?
    > Put the structure used by both programs it in a seperate header file, so
    > if it changes i wouldnt have to change it in 2 or more sources?
    > Or use #ifdef .. #endif?
    It depends on how those 2 programs are separated; if they are (part of)
    different projects, just put a copy of the header in each project, with the
    necessary modifications.

    If they are somewhat closely related (like, let's say, an
    encryption/decryption pair) or belong to the same project, you may want to
    have a single header where functions prototypes are between #ifdef...#endif

    Anyway, try to keep the header simple. Even in the latter case, if having a
    single header makes it hard to read, use 2.

    Sam
    --
    "If sharing a thing in no way diminishes it, it is not rightly owned if it is
    not shared."

    - St Augustine

    Sam Zoghaib Guest

  4. #3

    Default Re: Two structures, bunch of programs.

    Sam Zoghaib <NOsam@zep.homedns.orgSPAM> wrote in
    news:bf4nal$4hs$1@news-reader3.wanadoo.fr:
    > Peteris Krumins wrote in article
    > <Xns93BB13C4FC04Awhitesuneapollolv@130.133.1.4> on Thursday 17 July
    > 2003 00:57 in comp.unix.programmer:
    >
    >> What is the best aproach to use the same data structure used by 2 or
    >> more
    >> programs?
    >> Put the structure used by both programs it in a seperate header
    >> file, so
    >> if it changes i wouldnt have to change it in 2 or more sources?
    >> Or use #ifdef .. #endif?
    >
    > It depends on how those 2 programs are separated; if they are (part
    > of) different projects, just put a copy of the header in each project,
    > with the necessary modifications.
    >
    > If they are somewhat closely related (like, let's say, an
    > encryption/decryption pair) or belong to the same project, you may
    > want to have a single header where functions prototypes are between
    > #ifdef...#endif
    >
    > Anyway, try to keep the header simple. Even in the latter case, if
    > having a single header makes it hard to read, use 2.
    >
    > Sam
    Thanks for the tips.


    P.Krumins
    Peteris Krumins Guest

Posting Permissions

  • You may not post new threads
  • You may 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