On 03.09.2020 16:17, Tom Tromey wrote: >>>>>> "Kamil" == Kamil Rytarowski writes: > > Kamil> +2020-03-17 Kamil Rytarowski > Kamil> + > Kamil> + * eintr.h: Add handle_eintr. > > Kamil> +template > Kamil> +inline decltype (auto) handle_eintr (const Fun &F, const Args &... A) > > I like this, but from what I read it seems that "decltype(auto)" is > C++14 -- but gdb is still C++11. > OK, I have downgraded this to C++11. > > Kamil> +{ > Kamil> + decltype (F (A...)) ret; > Kamil> + do > Kamil> + { > Kamil> + errno = 0; > Kamil> + ret = F (A...); > Kamil> + } > Kamil> + while (ret == -1 && errno == EINTR); > > Also this seems to assume that "ret" is comparable to an int anyway. > So maybe just assuming int everywhere would be ok. > This assumption is not always valid, e.g. read(2) returns ssize_t. I've added in the template flexibility of the returned type as it could be e.g. nullptr for fopen(3). > Tom >