> |> We recently cleaned up integer types such that now `bool` is taken out > |> of the unsigned batch. For C2Y, there is a bijection between signed and > |> unsigned types. So it would perfectly possible to have type > |> operators `signedof` and `unsignedof` for integer types and then have > |> `typedef signedof(size_t) ssize_t;`. So technically, there is no > |> problem at all ;-) > |> > |> But to enshrine this in C2Y we would have to have an immediate use of > |> `ssize_t` within the C standard itself. So perhaps you guys should > |> propose to move some POSIX interface that imperatively needs `ssize_t` > |> into the C standard. > | > |Unfortunately, there are few that would be appropriate for ISO C. :-( > > Yeeeaaah. ISO C does not know directories exist. They store > anything flat. Ah wait, > > To avoid this race condition, the tmpfile_s function should be > used instead of tmpnam_s when possible. One situation that > requires the use of the tmpnam_s function is when the program > needs to create a temporary directory rather than a temporary > file. > > What is that, directory? > Who has a foot in that door, actually? > This is criminal!!!
Sorry, I have no clue about `tmpnam_s` `tmpfile_s`, it seems `tmpnam_s` `tmpfile_s` does not come from this thread. > > Having said that, my impression was always that of bureaucratic > farts. If you define an integer type, there should be an > equivalent with the other signedness. Period. > Exceptions are (maybe) abstraction things like uid_t or pid_t, but > please no one comes and starts splitting hairs with "size_t is also > an abstraction". And if only because everybody knows that you do > arithmetic with lengths and offsets, all the time. > > |The only two that really jump out at me as potentially transferable to > |C are `getdelim` and/or `getline`: > |https://pubs.opengroup.org/onlinepubs/9799919799/functions/getdelim.html > | > |A couple of others use `ssize_t` in their signatures and aren't > |obviously system-dependent: `strfmon` (formatting currency; I believe > |"mon" in this context is supposed to refer to "money"), and `swab` > |(which for some inscrutable reason takes a it's `len` argument as a > |`ssize_t`). Neither seems like a great fit for ISO C. > > Introduce posix_getdents() into ISO C! And require DT_FORCE_TYPE > right from the start. This is also confusing. We only care about those broadly used and across posix/win32/(others os) and users have to re-implement(hack) them from time to time. posix_getdents obviously is not the case. Search https://github.com/search?q=%2F%28%3F-i%29typedef+SSIZE_T%2F&type=code, that is `/(?-i)typedef SSIZE_T/`, we will have 8.7k files results. Search https://github.com/search?q=%2F%28%3F-i%29ssize_t%2F&type=code, that is `/(?-i)ssize_t/`, we will have 4.6M files Search https://github.com/search?q=%2F%28%3F-i%29size_t%2F&type=code, that is `/(?-i)size_t/`, we will have 34.5M files Search https://github.com/search?q=tmpnam_s&type=code, that is `tmpnam_s`, we will have 8.9k files Search https://github.com/search?q=tmpfile_s&type=code that is `tmpfile_s`, we will have 12.1k files Search https://github.com/search?q=posix_getdents+&type=code, that is `posix_getdents`, we will have 275 files So the ssize_t is so widely used(4.6M files), it's worth standardizing it in C2Y! > > --steffen > | > |Der Kragenbaer, The moon bear, > |der holt sich munter he cheerfully and one by one > |einen nach dem anderen runter wa.ks himself off > |(By Robert Gernhardt) -- Yours sincerely, Yonggang Luo
