dankamongmen / notcurses

blingful character graphics/TUI library. definitely not curses.
https://nick-black.com/dankwiki/index.php/Notcurses
Other
3.43k stars 113 forks source link

Duplicate declarations for notcurses_stdplane/_const? #2710

Closed michaelsbradleyjr closed 1 year ago

michaelsbradleyjr commented 1 year ago

Should one pair of these declarations be removed in favor of the other, or do they serve different purposes?

L1108-L1114

// Get a reference to the standard plane (one matching our current idea of the
// terminal size) for this terminal. The standard plane always exists, and its
// origin is always at the uppermost, leftmost cell of the terminal.
API struct ncplane* notcurses_stdplane(struct notcurses* nc)
  __attribute__ ((nonnull (1)));
API const struct ncplane* notcurses_stdplane_const(const struct notcurses* nc)
  __attribute__ ((nonnull (1)));

L1388-L1392

// Get a reference to the standard plane (one matching our current idea of the
// terminal size) for this terminal. The standard plane always exists, and its
// origin is always at the uppermost, leftmost cell of the terminal.
API struct ncplane* notcurses_stdplane(struct notcurses* nc);
API const struct ncplane* notcurses_stdplane_const(const struct notcurses* nc);
dankamongmen commented 1 year ago

one is the const variant, one is not const. if you have a const handle on the notcurses object, you can only use the const forms. they're provided so that you can use const notcurses more easily.

michaelsbradleyjr commented 1 year ago

Right, but there are two different pairs of const and not const with the same names. One pair uses __attribute__ ((nonnull (1))) the other does not.

dankamongmen commented 1 year ago

oh! so there is

dankamongmen commented 1 year ago

thanks, resolved!