Archive

Posts Tagged ‘Standard’

A fault in the C Standard or existing compilers?

February 24th, 2009 Derek-Jones No comments

Software is not the only entity that can contain faults. The requirements listed in a specification are usually considered to be correct, almost by definition. Of course the users of software implementing a specification may be unhappy with the behavior specified and wish that some alternative behavior occurred. A cut and dried fault occurs when two requirements conflict with each other.

The C Standard can be read as a specification for how C compilers should behave. Despite over 80 man years of effort and the continued scrutiny of developers over 20 years, faults continue to be uncovered. The latest potential fault (it is possible that the fault actually occurs in many existing compilers rather than the C Standard) was brought to my attention by Al Viro, one of the Sparse developers.

The issue involved the following code (which I believe the standard considers to be strictly conforming, but all the compilers I have tried disagree):

int (*f(int x))[sizeof x];  // A prototype declaration
 
int (*g(int y))[sizeof y]  // A function definition
{
return 0;
}

These function declarations are unusual in that their return type is a pointer to an array of integers, a type rarely encountered in this context (the original question involved a return type of pointer to function returning … and was more complicated).

The specific issue was the scope of the parameter (i.e., x and y), is the declaration still in scope at the point that the second occurrence of the identifier is encountered?

As a principle I think that the behavior, whatever it turns out to be, should be the same in both cases (neither the C standard or its rationale state such a principle).

Taking the function prototype case first:

The scope of the parameter x “… terminates at the end of the function declarator.” (sentence 409).

and does function prototype scope include the return type (the syntax calls the particular construct a declarator and there are at least two of them, one nested inside the other, in a function prototype declaration)?

Sentence 1592 says Yes, but sentence 279 and 1845 say No.

None of these references are normative references (standardize for definitive).

Moving on to the function definition case:

Where does the scope of the parameter x begin (sentence 418)?
… scope that begins just after the completion of its declarator.

and where does the scope end (sentence 408)?
… which terminates at the end of the associated block.

and what happens between the beginning and ending of the scope (sentence 412)?
Within the inner scope, the identifier designates the entity declared in the inner scope;

This looks very straight forward, there are no ‘gaps’ in the scope of the parameter definition appearing in a function definition. Consistency with the corresponding function prototype case requires that function declarator be interpreted to include the return type.

There is a related discussion involving a previous Defect Report 345 submitted a while ago.

The problem is that many existing compilers do not treat parameter scope in this way. They operate as-if there was a ‘gap’ in the parameter scope of function definition (probably because the code implementing this functionality is shared with that implementing function prototypes, which have been interpreted to not include the return type).

What happens next? Probably lots of discussion on the C Standard email reflector. Possible outcomes include somebody finding wording that requires a ‘gap’ in the scope of parameters in function definitions, it agreed that such a gap ought to be specified by the standard (because this is how existing code behaves because this is how compilers operate), or that the standard is correct as is and any compiler that behaves differently needs to be fixed.

C++ goes for too big to fail

December 8th, 2008 Derek-Jones No comments

If you believe the Whorfian hypothesis that language effects thought, even in one of its weaker forms, then major changes to a programming language will effect the shape of the code its users write.

I was at the first International C++ Standard meeting in London during 1991 and coming from a C Standard background I could not believe the number of new constructs being invented (the C committee had a stated principle that a construct be supported by at least one implementation before it be considered for inclusion in the standard; ok, this was not always followed to the letter). The C++ committee members continued to design away, putting in a huge amount of effort, and the document was ratified before the end of the century.

The standard is currently undergoing a major revision and the amount of language design going on puts the original committee to shame. With over 1,300 pages in the latest draft nobodies favorite construct is omitted. The UK C++ panel has over 10 people actively working on producing comments and may produce over 1,000 on the latest draft.

With so many people committed to the approach being taken in the development of the revised C++ Standard its current direction is very unlikely to change. The fact that most ‘real world’ developers only understand a fraction of what is contained in the existing standard has not stopped it being very widely used and generally considered as a ’success’. What is the big deal over a doubling of the number of pages in a language definition, the majority of developers will continue to use the small subset that they each individually have used for years.

The large number of syntactic ambiguities make it is very difficult to parse C++ (semantic information is required to resolve the ambiguities and the code to do this is an at least an order of magnitude bigger than the lexer+parser). This difficulty is why there are so few source code analysis tools available for C++, compared to C and Java which are much much easier to parse. The difficulty of producing tools means that researchers rarely analyse C++ code and only reasonably well funded efforts are capably of producing worthwhile static analysis tools.

Like many of the active committee members I have mixed feelings about this feature bloat. Yes it is bad, but it will keep us all actively employed on interesting projects for many years to come. As the current financial crisis has shown, one of the advantages of being big and not understood is that you might get to being too big to fail.

Will IEEE 754 become a fringe representation?

December 1st, 2008 Derek-Jones No comments

Many people believe that with a few historical exceptions the IEEE 754 standard has won the floating-point value bit-representation battle.  What these people have forgotten is that money rules; customers are willing to ditch standards if it increases profit. FPGA devices can be configured to perform float-point operations faster and more cheaply than commodity cpus.

Making optimal use of a FPGA may require using a radix of 4 and for the time being automatically convert back and forth between an external 754 radix-2 representation.  In those cases where multiplication/division operations are more common than addition/subtraction use of a logarithmic number system has performance benefits.  For specialist scientific calculations (where cpu time is measured in days) purpose built FPGA devices are the path to significant performance improvements.  In many mass market applications the full power of a 32-bit representation is not needed and a representation using fewer bits does an acceptable job using less powerful (ie, cheaper) hardware.

Customer demand for higher performance and lower cost will push vendors to deliver purpose designed products.  IEEE 754 may be the floating-point representation that people without spending power use because it was once  designed into cpus and vendors are forced to continue to support it for backwards compatibility.

www.wenn.com
FireStats icon Powered by FireStatswww.tinynibbles.com buy propecia now

brand name cialis

cheapest viagra

online cialis

cialis discount

info levitra

cialis fast delivery

get levitra

online cheap viagra

healthcare canadian pharmacy

generic propecia online pharmacy

online propecia uk

ordering propecia online

cialis discounts

buy levitra online from canada

cialis 5 mg

cialis professional no prescription

cost levitra low

generic levitra cheap

levitra in india

cialis price 100 mg

levitra prescription

mail order propecia

cialis alternative

buy viagra mexico

cialis one a day

cheap cialis soft

buy cialis online uk

buying cialis soft tabs 100 mg

indian cialis

generic levitra online

cialis cheap

buy propecia where

cheap levitra without prescription

buy real cialis

cheap fast levitra

buy viagra germany canadian meds

buy viagra

cheap cialis

drug generic propecia

canadian pharmacies cialis

buying propecia online

brand name cialis overnight

cialis overnight

cialis strenght mg

canada viagra

lowest price levitra

buy cialis usa

buy propecia without prescription

buy levitra online no prescription

levitra where to buy

cialis delivered overnight

generic levitra purchase

cialis dosage mg

how much to buy viagra in pounds

cost of viagra

ganeric cialis

cost of propecia

cialis and diarrhea

cialis to buy

buy propecia cheap

hydrochlorothiazide cialis

discount propecia online

buy viagra without prescription

for sale levitra

buy viagra china

how strong is 5 mg of cialis

buy cialis for daily use

cialis tablets foreign

canadian pharmacy discount code viagra

mexico levitra

lowest price for propecia

levitra sales uk

cialis transdermal

online levitra

how to buy cialis in canada

how much is viagra

buy prescription propecia without

buy propecia generic

cialis prescription

discount us propecia

online viagra gel to buy

cheap propecia online prescription

buy cheap levitra online

daily dosage cialis

canadian propecia rx

levitra mail order

cheap prescription propecia

cialis in mexico

cialis cheap us pharmacy

best price for generic cialis

generic propecia alternative

i need to buy propecia

cialis headaches

cheap levitra uk

get levitra online

lowest price propecia best

discount levitra online

levitra discount

online ordering propecia

can i get viagra in mexico

buy cheap generic propecia

best price levitra

generic propecia sale

natural viagra

levitra online

cheapest price propecia cheap

order generic levitra

brand cialis for sale

buying cialis

buy propecia online

discount propecia rx

buying generic cialis mexico rx

cialis on women

low cost propecia

cialis fast delivery usa

indian viagra

5 mg daily cialis

cheapest viagra usa

buy dosages levitra

generic levitra overnight delivery

buy generic cialis

canadian pharmacy

levitra low price

canada viagra generic

buy fast propecia

bio viagra herbal

order viagra or levitra

buy viagra on line

online propecia prescription

buy propecia on line

cheap levitra prescription

discount levitra rx

levitra online prescription

cialis en mexico

cialis by mail

low cost canadian viagra

buy generic viagra india rx

canadian healthcare pharmacy

cheapest overnight cialis

cheap viagra canada or india

getting cialis from canada

generic viagra canadian

generic levitra canada

buying viagra in canada

buying online propecia

overnight delivery cialis

mail order levitra

canada meds viagra

buy cheap levitra

cheap levitra

cost of daily cialis

cialis profesional

cialis 100 mg

buy online prescription propecia

cialis and ketoconazole

buy cialis once daily

cialis price

levitra online sales

levitra for sale

canadian viagra and healthcare

levitra in canada

obtain viagra without prescription

overnight delivery viagra

herbal propecia

cialis professional 20 mg

buy cialis canada

low price levitra

discount propecia propecia

cheap discount levitra

generic viagra 100 mg

levitra buy online

cheapest propecia uk

female viagra pills

canadian online pharmacy cialis

levitra cheap fast

levitra 10mg

buy can from i propecia who

generic propecia effective

cialis overnight delivery

levitra canadian

cheap canadian viagra

cialis next day delivery

cialis 100 mg generic

cialis online

generic propecia for sale

lowest cost levitra

levitra from canadian pharmacy

how to get viagra

buy cialis online canada

cialis pharmacy

lowest propecia 1 mg

canada propecia prescription

cialis no prescription

generic cialis soft tabs

levitra mg

lowest propecia prices in canada

order cheap propecia

get propecia online pharmacy

cialis vs levitra

cialis 5 mg buy

generic viagra india

order propecia

generic propecia finasteride

bestellen levitra online

best price cialis

best price generic propecia

buy propecia online from usa pharmacy

canada cheap propecia

buy propecia prescriptions online

buy viagra online

buying propecia

canadian pharmacy viagra

next day viagra

cheapest propecia prescription

buy now propecia

cialis from mexico

best viagra

cheapest viagra online

get cialis online

genuine cialis pills

discount levitra purchase

levitra viagra cialis

50 mg cialis

cialis and canada custom

mail online order propecia

get cialis

buy cialis without prescription

lowest price on non generic levitra

canadian drugs propecia

cialis 50 mg

buy cheapest propecia

buy canada levitra

online pharmacy propecia renova

how much cialis

once daily cialis

best price propecia

buying generic propecia

next day delivery cialis

levitra online overnight delivery

cialis 20 mg

generic propecia fda approved

fda levitra

canada online pharmacy levitra

order prescription propecia

once a day viagra

buy generic levitra

5 mg original brand cialis

canadian viagra

levitra now online

china viagra

cheap cialis from india

levitra cost

cheap propecia uk

combine cialis and levitra

cialis professional 100 mg

lowest propecia prices

brand viagra over the net

buy cialis cannada

discount cialis india

buy propecia online prescription

buy propecia canada

buy levitra overnight

cialis refractory

cialis generic 100 mg

order cheap levitra

canadian healthcare viagra

cheap order prescription propecia

buy discount viagra

cialis quick shipment

order cheapest propecia online

canada generic propecia

buy propecia online pharmacy

discount drug propecia

cialis daily

buy cialis 5 mg

cheap viagra from uk

canadian viagra india

generic viagra made in india

levitra tabs

cialis woman

lowest price propecia

indian cialis generic

generic levitra vardenafil

buy levitra online viagra

buy cialis fedex shipping

cialis next day

online generic cialis 100 mg

canadian pharmacy cialis

buy branded viagra

how much does cialis cost

buy cialis in usa

discount generic propecia

cialis soft pills

internet pharmacy propecia

cialis daily in canada

cialis tablets

levitra pill

canada levitra

cialis for woman