Re: cvs commit: src/lib/libc/sys tls.2

看板DFBSD_commit作者時間21年前 (2005/03/22 04:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串7/20 (看更多)
On Mon, 21 Mar 2005 11:37:27 -0800 (PST) Matthew Dillon <dillon@apollo.backplane.com> wrote: > > : > :On Mon, 21 Mar 2005 11:15:32 -0800 (PST) > :Matthew Dillon <dillon@apollo.backplane.com> wrote: > : > :> Grumble (Matt goes off in a corner and mumbles about stupid > standards :> which use unsigned ints because some bozo wanted to > write 2.1GB of data :> in one go, when they really ought to just > use normal ints). : > :Why ought they do that? > : > :(or: why would one ever want a *negative* infosize?!) > : > :-Chris > > It's not that, it's the same issue with sizeof() returning > unsigned when it really just ought to return an int. Oh heck yeah. I'm not sure about the other reasons, but this one alone takes the cake. I wouldn't say it should return an int, though: IMO sizeof(x) ought to be treated just like any other numeric constant in C - that is, interpreted as signed or unsigned as the situation dictates. Why they introduced this gratuitous unorthogonality, I have no idea. Well, maybe that's not strictly true... I _can_ guess. Probably "sizeof always yields a positive number so we should force its type to be unsigned." But that makes exactly as much sense as "4 always yields a positive number so we should force its type to be unsigned," which is stupid. -Chris
文章代碼(AID): #12FoW900 (DFBSD_commit)
討論串 (同標題文章)
文章代碼(AID): #12FoW900 (DFBSD_commit)