[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] ✘GPSD_API
From: |
Eric S. Raymond |
Subject: |
Re: [gpsd-dev] ✘GPSD_API |
Date: |
Thu, 14 Apr 2016 04:06:57 -0400 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Hal Murray <address@hidden>:
>
> address@hidden said:
> > It is not clear to me what constitutes a compatible channge and what is an
> > incompatible change.
>
> Compatible change means that any program that worked with the old library
> will continue to work with the new library. That assumes the program follows
> the API. Your call on what happens if the program cheats. If a cheat is
> widely used it should probably be promoted to part of the API, at least in
> this context.
>
> Obvious examples are adding subroutines.
>
>
> > I'm guessing that if I added a field to satellite_t skyview, which is in
> > gps_data_t, that would be an incompatible change?o
>
> There are two issues. Does a client care about the size? Did you move any
> of the current slots?
>
> You can safely add something to the end of a struct if the client only deals
> with pointers to the struct. There is no guarantee that the client won't
> copy the contents which means knowing the size to allocate space for the
> copy. But they will only copy as much as they know about so that won't break
> anything. It might break if they copy stuff back which won't update the new
> fields. The documentation for the API probably doesn't explicitly say
> don't-do-that, but unless there is some reason hinted at in the API I
> wouldn't worry about that case. It would help to make the API return
> pointers to const xxx.
>
> Don't forget to check for the case where a struct you want to enlarge is used
> in another struct.
All of this is correct and parallels the rules *I* have been using for
distinguishing between compatible and incompatible changes.
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
Re: [gpsd-dev] ✘GPSD_API, Eric S. Raymond, 2016/04/14
- Re: [gpsd-dev] ✘GPSD_API, Gary E. Miller, 2016/04/14
- Re: [gpsd-dev] ✘GPSD_API, Eric S. Raymond, 2016/04/14
- Re: [gpsd-dev] ✘GPSD_API, Fred Wright, 2016/04/14
- Re: [gpsd-dev] ✘GPSD_API, Gary E. Miller, 2016/04/14
- Re: [gpsd-dev] ✘GPSD_API, Fred Wright, 2016/04/14
- Re: [gpsd-dev] ✘GPSD_API, Gary E. Miller, 2016/04/14