mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
README: add FAQ entry about c++ scopes
This commit is contained in:
parent
5b4e285798
commit
c04a68896c
@ -2519,6 +2519,9 @@ up someday **FIXME**.
|
||||
* *Q:* One of the demos claimed to spend more than 100% of its runtime rendering. Do you know how to count?
|
||||
* *A:* Runtime is wall clock time. A multithreaded demo can spend more than the wall-clock time rendering if the threads contend.
|
||||
|
||||
* *Q:* Using the C++ wrapper, how can I ensure that the `NotCurses` destructor is run when I return from `main()`?
|
||||
* *A:* As noted in the [C++ FAQ](https://isocpp.org/wiki/faq/dtors#artificial-block-to-control-lifetimes), wrap it in an artificial scope (this assumes your `NotCurses` is scoped to `main()`).
|
||||
|
||||
## Supplemental material
|
||||
|
||||
### Useful links
|
||||
|
@ -877,10 +877,6 @@ notcurses* notcurses_init(const notcurses_options* opts, FILE* outfp){
|
||||
free_plane(ret->top);
|
||||
goto err;
|
||||
}
|
||||
if(ret->smcup && term_emit("smcup", ret->smcup, ret->ttyfp, false)){
|
||||
free_plane(ret->top);
|
||||
goto err;
|
||||
}
|
||||
if((ret->rstate.mstreamfp = open_memstream(&ret->rstate.mstream, &ret->rstate.mstrsize)) == NULL){
|
||||
free_plane(ret->top);
|
||||
goto err;
|
||||
@ -889,7 +885,7 @@ notcurses* notcurses_init(const notcurses_options* opts, FILE* outfp){
|
||||
if(!opts->suppress_banner){
|
||||
char prefixbuf[BPREFIXSTRLEN + 1];
|
||||
term_fg_palindex(ret, ret->ttyfp, ret->colors <= 256 ? 50 % ret->colors : 0x20e080);
|
||||
fprintf(ret->ttyfp, "\n notcurses %s by nick black", notcurses_version());
|
||||
fprintf(ret->ttyfp, "\n notcurses %s by nick black et al", notcurses_version());
|
||||
term_fg_palindex(ret, ret->ttyfp, ret->colors <= 256 ? 12 % ret->colors : 0x2080e0);
|
||||
fprintf(ret->ttyfp, "\n %d rows, %d columns (%sB), %d colors (%s)\n"
|
||||
" compiled with gcc-%s\n"
|
||||
@ -920,6 +916,10 @@ notcurses* notcurses_init(const notcurses_options* opts, FILE* outfp){
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ret->smcup && term_emit("smcup", ret->smcup, ret->ttyfp, false)){
|
||||
free_plane(ret->top);
|
||||
goto err;
|
||||
}
|
||||
return ret;
|
||||
|
||||
err:
|
||||
|
Loading…
x
Reference in New Issue
Block a user