[Cfp-interest] freestanding

Jim Thomas jaswthomas at sbcglobal.net
Fri Feb 24 08:33:41 PST 2012


Feedback from the C committee urged the following changes to our draft TS Part 1:

Allow freestanding implementations to conform. 
Guard library interfaces with a WANT macro.
In Table 1 add a column (or two) with forward references (clause numbers) for the C operations in the row. (The current order in the table seemed ok.)
Distinguish text in (and proposed for) the C standard from other text in the TS, by indentation (or some other means).
Find a better way to specify function calls that are affected by constant rounding modes. One approach is to list potentially affected functions (in a table) and have their invocations be affected if macro replacement has not been suppressed. This approach seemed promising after review by interested committee members.
I've done the last four in my copy of our working draft, which I'll post for review soon. 

A key issue for the first one is avoiding the requirement for freestanding implementations to support <stdlib.h> and <stdio.h>. Below is a draft specification for a new header that provides the character sequence conversion functionality required by IEEE 754. Please look it over and send comments. I'd be particularly interested in hearing from Joel, who first asked for this facility.

-Jim

=======================

n          Floating-point string conversions <floatstr.h>
 
The header <floatstr.h> defines one type and five functions for converting between floating types and decimal character sequences.
 
The type declared is size_t (described in 7.19).
 
n.1       The strfromd and strfromld functions
 
Synopsis
 
#include <floatstr.h>
int strfromd(char * restrict s, size_t n, const char * restrict format, double x);
int strfromld(char * restrict s, size_t n, const char * restrict format, long double x);
 
Descripton
 
The strfromd and strfromld functions are defined by snprintf(s, n, format, x) (7.21.6.5).
 
NOTE  If the conversion specifier (in the string pointed to by format) for x is not for type double or long double, the behavior of strfromd or strfromld, respectively, is undefined.
 
Returns
 
The strfromd and strfromld functons return the values returned by snprintf(s, n, format, x) (7.21.6.5).
 
n.2       The strtod, strtof, and strtold functions
 
Synopsis
 
#include <floatstr.h>

double strtod(const char * restrict nptr, char ** restrict endptr);
float strtof(const char * restrict nptr, char ** restrict endptr);
long double strtold(const char * restrict nptr, char ** restrict endptr);
.         
These functions are specified in 7.22.1.3.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20120224/ef2d4f71/attachment.html 


More information about the Cfp-interest mailing list