Uploaded image for project: 'Traffic Server'
  1. Traffic Server
  2. TS-680

Make SDK opaque types use opaque struct's instead of void* ?

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.1.7
    • TS API
    • None

    Description

      This could allow a compiler to warn on inappropriate parameters for example.

      The problem is that many API parameters are passed as (void*). This means that not only can they can unsafely interchanged (either passing the wrong parameter or passing them in the wrong order) but completely inappropriate (non-API) pointers can be passed as well, all without any warning from the compiler.

      This could be improved by declaring parameter types to be pointers to in name only types. This would make them non-trivially interchangeable with each other and non-API pointers. Although passing inappropriate parameters would still be possible it would be much harder to do by accident, in contrast to the current API in which it is very easy to do.

      Attachments

        1. prototypes.diff
          15 kB
          Leif Hedstrom

        Activity

          People

            zwoop Leif Hedstrom
            zwoop Leif Hedstrom
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: