Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Auto-execute code at exit? Date: Fri, 22 Dec 2017 12:02:36 -0800 Organization: None to speak of Lines: 44 Message-ID: References: <016d6ddd-a7f6-498f-9fa0-244a5879bb9f@googlegroups.com> <0LUZB.55083$rE1.34849@fx14.am4> <87tvwjg5rs.fsf@bsb.me.uk> <87efnnfs3x.fsf@bsb.me.uk> <873742g0hx.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="414aff292d7a2ee2dd7e7180816bdc81"; logging-data="23499"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3wjyB8BZq3SOXSG0B2ZN7" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:HY/Ab//hudq/n09vx+gKZd/x86s= sha1:iSvsvqLwR3t9mmzc+Z2jmOx57DQ= Xref: csiph.com comp.lang.c:124603 bartc writes: > On 22/12/2017 17:01, Ben Bacarisse wrote: >> bartc writes: >>> clock() is a special case. >> >> Right. So why should that case cause you to do anything different for >> the other cases? >> >> Is the problem that your code generator don't know that that is anything >> special about the type of clock()-t? > > Yes. If it was just clock(), there's a possibility of it detecting it's > a foreign C function which could mean requiring a belt-and-braces > approach to type-checking. > > But not when it's a term of a general expression. The type of clock()-t > is just int. No, it (probably) isn't. It depends on the type of clock_t and of the expression t, whatever that is. If clock_t is long, then clock()-t *cannot* be of type int. (If t is of type double, for example, then the expression is of type double.) > (And since I've just learnt that clock_t is type long int, it now > becomes a problem to declare clock() in this other language. It has a > type that varies depending on target OS.) What? You say it's long int, and then you say it varies. You've just learned that clock_t is of type long int on the particular implementation you're using. [...] > I don't like long because it doesn't fit tidily into my type system: But it does fit tidily into C's type system. [...] -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"