| Deutsch English Français Italiano |
|
<vs26v2$2va7u$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: James Kuyper <jameskuyper@alumni.caltech.edu> Newsgroups: comp.lang.c Subject: Re: Integral types and own type definitions (was Re: Suggested method for returning a string from a C program?) Date: Wed, 26 Mar 2025 14:07:05 -0400 Organization: A noiseless patient Spider Lines: 23 Message-ID: <vs26v2$2va7u$1@dont-email.me> References: <vrd77d$3nvtf$2@dont-email.me> <vrdhok$47cb$2@dont-email.me> <20250319115550.0000676f@yahoo.com> <vreuj1$1asii$4@dont-email.me> <vreve4$19klp$2@dont-email.me> <20250319201903.00005452@yahoo.com> <86r02roqdq.fsf@linuxsc.com> <vrh1br$35029$2@dont-email.me> <LRUCP.2$541.0@fx47.iad> <vrh71t$3be42$1@dont-email.me> <KFVCP.594649$SZca.498578@fx13.iad> <vrhb77$3frk8$1@dont-email.me> <vrru8f$174q6$1@dont-email.me> <86o6xpk8sn.fsf@linuxsc.com> <vrtmu4$2s1q2$1@dont-email.me> <20250325011327.41@kylheku.com> <20250325131110.000056bd@yahoo.com> <86bjtpjp22.fsf@linuxsc.com> <vruid4$3iuvq$1@dont-email.me> <87iknw7sz8.fsf@nosuchdomain.example.com> <vs0e6r$1avlb$2@dont-email.me> <87sen05cza.fsf@nosuchdomain.example.com> <vs0olv$1lodm$1@dont-email.me> <vs14p5$20ejf$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Date: Thu, 27 Mar 2025 01:43:17 +0100 (CET) Injection-Info: dont-email.me; posting-host="eff95a41abdb2adbb2d98178d6a0459a"; logging-data="3123454"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Hf04gcNYlMH/9AKrqIHtQlHwKSV715qc=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:OXJBeCojo4bb2HuL4Hig0glrekA= Content-Language: en-US In-Reply-To: <vs14p5$20ejf$1@dont-email.me> On 3/26/25 10:59, Janis Papanagnou wrote: > On 26.03.2025 12:33, David Brown wrote: .... >> Even in C (in a desperate attempt to bring us back on topic for the >> group), there are no negative integer constants - merely positive >> integer constants with a unary minus operator applied. > > Is that so? (Harmlessly asking.) - I mean, if I write int x = -5; > does it matter (in "C") whether its parsed as <integer number> or > <negation> <positive number> ? It does make a difference in some contexts, but not in that one. The problem I remember best is that if, for instance, the minimum integer that can be represented by an int has the value -32768, then the integer literal 32768 represents a value too big to be represented as an integer, so it has the type 'long int' rather than 'int'. As result, since the expression -32768 is parsed as the unary - operator applied to 32768, that expression also has the type 'long int'. That makes it unsuitable as the #definition of INT_MIN. A popular alternative is to #define INT_MIN as (-32767-1). The same issue applies to INT_MIN regardless of what value it has, I chose 16 bits only to reduce typing.