X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f NNTP-Posting-Date: Sat, 19 Nov 2005 16:09:48 -0600 Date: Sat, 19 Nov 2005 17:09:50 -0500 From: Joe Wright User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: printf() doesn't print long long intege, maybe RHIDE problem References: <437d9a13 AT news DOT bezeqint DOT net> <9krff.1763$wf DOT 538 AT newsread3 DOT news DOT atl DOT earthlink DOT net> <437e55e2 DOT 279951667 AT localhost> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 94 NNTP-Posting-Host: 69.143.13.12 X-Trace: sv3-cHLjnW+i/4j6XEW21nABd1+z7XVROg9M9A1MrBwH8fX1WDH15UsQ3B8wk3+9EgUEp6cmK1cgo2YNC73!N8APB0cfUyu/QfWno84BbCWVkifrO8hKZuHK5Q+Rj1q2HOySPuStgHJbT3q2Q84q34QZ8uQNMA2V!CA== X-Complaints-To: abuse AT comcast DOT net X-DMCA-Complaints-To: dmca AT comcast DOT net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Martin Ambuhl wrote: > Rod Pemberton wrote: > >> "Martin Ambuhl" wrote in message >> news:Iayff.1893$wf DOT 1283 AT newsread3 DOT news DOT atl DOT earthlink DOT net... >> >>> Rod Pemberton wrote: >>> >>>> "Martin Ambuhl" wrote in message >>>> news:Cxvff.2173$N45 DOT 189 AT newsread1 DOT news DOT atl DOT earthlink DOT net... >>>> >>>> >>>>> Scott wrote: >>>>> >>>>> >>>>>> On Fri, 18 Nov 2005 21:03:01 GMT, Martin Ambuhl >>>>>> >>>>>> wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>>> printf() do not print long long integer. >>>>>>> >>>>>>> >>>>>>> Show us how it fails. Here is an example of it working: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> Here's another example: >>>>>> >>>>>> printf("%llX\n", (long long)-1); >>>>> >>>>> >>>>> If you mean an example of undefined behavior. The %llX specifier >>>>> expects an unsigned long long; (long long)-1 is not unsigned. >>>> >>>> >>>> >>>> It's probably better to use capital L, instead of ll, since it works >> >> >> with >> >>>> multiple compilers... >>>> e.g., >>>> >>>> sscanf(s,"%Lx",&value); >>>> >>>> printf("%Lu:%Lx\n",prime,counter); >>>> >>> >>> Wrong. Since the L length modifier specifies that the argument is a >>> long double, you've found another way to screw things up. >> >> >> >> No sir, I am correct. You are partially correct. > > > Come off it. You claimed that > > It's probably better to use capital L, instead of ll, since it works > > with multiple compilers... > > This is a gross error. Read what you have quoted from the standard: > >> an optional L specifying that a following e , E , f , g , or G conversion >> specifier applies to a long double argument. If an h , l , or L >> appears with >> any other conversion specifier, the behavior is undefined. > > > Suggesting replacing a correct standard specifier with one with > undefined behavior which is specific to particular implementations is a > very peculiar way to targer "multiple compilers." You do a real > disservice by doing such and should stop it. Your attempt to justify > this anti-social suggestion contains the very language which shows you > to be wrong. Martin, please don't fight this one. From gcc's info on printf.. * An optional conversion qualifier, which may be `h' to specify `short', `l' to specify long ints, or `L' to specify long doubles. Long long type can be specified by `L' or `ll'. Clearly %d is int, %ld is long int and %lld and %Ld are long long int. These are qualifiers of specifiers, not specifiers themselves. Clearly %f specifies a double and qualified %Lf a long double. -- Joe Wright "Everything should be made as simple as possible, but not simpler." --- Albert Einstein ---