public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* Re: [Help-gsl] GSL and C99 standard
       [not found] <b954b2060804090947j2574cf96y4ce9262b2fd55e77@mail.gmail.com>
@ 2008-04-10 16:42 ` Brian Gough
  2008-04-10 19:19   ` Gerard Jungman
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Brian Gough @ 2008-04-10 16:42 UTC (permalink / raw)
  To: Hongzheng Wang; +Cc: help-gsl, gsl-discuss

At Thu, 10 Apr 2008 00:47:06 +0800,
Hongzheng Wang wrote:
> Although C99 standard has not been fully implemented in GCC, several
> new key features, e.g. complex type support, are indeed useful to
> numerical computations.  So, I wonder if there is any plan for the
> development of GSL to embrass C99 standard and adopt these useful
> offers.

Do complex types acually work now? I haven't checked for a while but
according to http://gcc.gnu.org/gcc-4.3/c99status.html they weren't
completed.

I would like to keep C89 compatibility, which limits the extent to
which any new features can be used.

-- 
Brian Gough

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Help-gsl] GSL and C99 standard
  2008-04-10 16:42 ` [Help-gsl] GSL and C99 standard Brian Gough
@ 2008-04-10 19:19   ` Gerard Jungman
  2008-04-11  8:00   ` Hongzheng Wang
  2008-04-11 12:41   ` Heikki Orsila
  2 siblings, 0 replies; 7+ messages in thread
From: Gerard Jungman @ 2008-04-10 19:19 UTC (permalink / raw)
  To: gsl-discuss


The other problem with C99 complex types is that they
introduce yet another possibility for variation in
binary layout, alignment, etc.

The three "complex" types that need to play together are
Fortran COMPLEX, C++ std::complex, and now C99 complex.
And there are (as of yet, AFAIK) no compatibility guarantees
for these on any platform, even though they should
probably work "most of the time".

It's really a stupid situation. At the very least, the C++
and C99 committees should decide on something. But they
probably never will.

--
Gerard Jungman


On Thu, 2008-04-10 at 17:41 +0100, Brian Gough wrote:
> At Thu, 10 Apr 2008 00:47:06 +0800,
> Hongzheng Wang wrote:
> > Although C99 standard has not been fully implemented in GCC, several
> > new key features, e.g. complex type support, are indeed useful to
> > numerical computations.  So, I wonder if there is any plan for the
> > development of GSL to embrass C99 standard and adopt these useful
> > offers.
> 
> Do complex types acually work now? I haven't checked for a while but
> according to http://gcc.gnu.org/gcc-4.3/c99status.html they weren't
> completed.
> 
> I would like to keep C89 compatibility, which limits the extent to
> which any new features can be used.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Help-gsl] GSL and C99 standard
  2008-04-10 16:42 ` [Help-gsl] GSL and C99 standard Brian Gough
  2008-04-10 19:19   ` Gerard Jungman
@ 2008-04-11  8:00   ` Hongzheng Wang
  2008-04-11 12:41   ` Heikki Orsila
  2 siblings, 0 replies; 7+ messages in thread
From: Hongzheng Wang @ 2008-04-11  8:00 UTC (permalink / raw)
  To: gsl-discuss; +Cc: help-gsl

On Fri, Apr 11, 2008 at 12:41 AM, Brian Gough <bjg@gnu.org> wrote:
> At Thu, 10 Apr 2008 00:47:06 +0800,
>
>  Do complex types acually work now? I haven't checked for a while but
>  according to http://gcc.gnu.org/gcc-4.3/c99status.html they weren't
>  completed.
Yes, you are right.  The complex support (in C99 sense) is still broken.
The failure may be due to the incompatibility between the complex number
extension of gcc itself and the complex support in C99 standard.
>
>  I would like to keep C89 compatibility, which limits the extent to
>  which any new features can be used.
This is the safest choice, compared with those relying on unstable C99 support
or gcc's extensions.
>
>  --
>  Brian Gough
>



-- 
HZ

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Help-gsl] GSL and C99 standard
  2008-04-10 16:42 ` [Help-gsl] GSL and C99 standard Brian Gough
  2008-04-10 19:19   ` Gerard Jungman
  2008-04-11  8:00   ` Hongzheng Wang
@ 2008-04-11 12:41   ` Heikki Orsila
  2008-04-15 10:37     ` Brian Gough
  2 siblings, 1 reply; 7+ messages in thread
From: Heikki Orsila @ 2008-04-11 12:41 UTC (permalink / raw)
  To: gsl-discuss; +Cc: Hongzheng Wang, help-gsl

On Thu, Apr 10, 2008 at 05:41:25PM +0100, Brian Gough wrote:
> I would like to keep C89 compatibility, which limits the extent to
> which any new features can be used.

Are there many users that can not support any C99 features?

I think the the relevant question is which C99 features, not the whole 
feature set. For example, I would like to use named initializers for 
structures as they make code more maintainable and easier to read:

C89:
	struct foo bar;
	memset(&bar, 0, sizeof bar);
	bar.name = value;

C99:
	struct foo bar = {.name = value};

gcc has supported this feature for ages already..

-- 
Heikki Orsila
heikki.orsila@iki.fi
http://www.iki.fi/shd

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Help-gsl] GSL and C99 standard
  2008-04-11 12:41   ` Heikki Orsila
@ 2008-04-15 10:37     ` Brian Gough
  2008-04-15 11:00       ` Heikki Orsila
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Gough @ 2008-04-15 10:37 UTC (permalink / raw)
  To: gsl-discuss, Hongzheng Wang, help-gsl

At Fri, 11 Apr 2008 15:40:25 +0300,
Heikki Orsila wrote:
> Are there many users that can not support any C99 features?

One area I know of: it is a problem for embedded systems, when
compilers aren't updated by the manufacturer.  That's something I want
to support.

> I think the the relevant question is which C99 features, not the whole 
> feature set. For example, I would like to use named initializers for 
> structures as they make code more maintainable and easier to read:
> gcc has supported this feature for ages already..

For code internal to the library I think we would stick with C89
compatible syntax.  

It makes sense to use C99 functions internally where it's possible to
do that without breaking C89 compatibility, by providing portable
versions as a fallback.  We've done some of that with functions like
isfinite(), but there are other cases that could be changed.

It is mainly a question of how C99 could benefit users.  The main
areas would be

 - native complex numbers
 - restricted pointers for optimisation
 - new IEEE floating point functions/exception handling

-- 
Brian Gough

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Help-gsl] GSL and C99 standard
  2008-04-15 10:37     ` Brian Gough
@ 2008-04-15 11:00       ` Heikki Orsila
  2008-04-15 15:12         ` Hongzheng Wang
  0 siblings, 1 reply; 7+ messages in thread
From: Heikki Orsila @ 2008-04-15 11:00 UTC (permalink / raw)
  To: Brian Gough; +Cc: gsl-discuss, Hongzheng Wang, help-gsl

On Tue, Apr 15, 2008 at 11:37:10AM +0100, Brian Gough wrote:
> At Fri, 11 Apr 2008 15:40:25 +0300,
> Heikki Orsila wrote:
> > Are there many users that can not support any C99 features?
> 
> One area I know of: it is a problem for embedded systems, when
> compilers aren't updated by the manufacturer.  That's something I want
> to support.

How many embedded systems really lack this? Existing users may use old 
versions of the library if C99 is allowed. Afaik, most embedded systems 
support GNU compilers thesedays. And, we're not argeting 8/16 bit 
systems with GSL ;)

> > I think the the relevant question is which C99 features, not the whole 
> > feature set. For example, I would like to use named initializers for 
> > structures as they make code more maintainable and easier to read:
> > gcc has supported this feature for ages already..
> 
> For code internal to the library I think we would stick with C89
> compatible syntax.  
> 
> It makes sense to use C99 functions internally where it's possible to
> do that without breaking C89 compatibility, by providing portable
> versions as a fallback.  We've done some of that with functions like
> isfinite(), but there are other cases that could be changed.

Writing both C89 and C99 implementations doubles the number of bugs. So 
it's definitely not wise to use C99 if a C89 implementation exists.

> It is mainly a question of how C99 could benefit users.  The main
> areas would be
> 
>  - native complex numbers
>  - restricted pointers for optimisation
>  - new IEEE floating point functions/exception handling

The benefit of C99 is common conventions that are portable between 
projects. The new floating point stuff is probably useful for GSL, but I 
see C99 being much more than that. It makes general coding easier.

-- 
Heikki Orsila
heikki.orsila@iki.fi
http://www.iki.fi/shd

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Help-gsl] GSL and C99 standard
  2008-04-15 11:00       ` Heikki Orsila
@ 2008-04-15 15:12         ` Hongzheng Wang
  0 siblings, 0 replies; 7+ messages in thread
From: Hongzheng Wang @ 2008-04-15 15:12 UTC (permalink / raw)
  To: Heikki Orsila; +Cc: Brian Gough, gsl-discuss, help-gsl

>  The benefit of C99 is common conventions that are portable between
>  projects. The new floating point stuff is probably useful for GSL, but I
>  see C99 being much more than that. It makes general coding easier.

Agree.

Basically, I think the problem is not just what benefits we could get
when utilizing the new features of C99.  More important thing, in my
opinion, is that GSL must be ready for these welcome elements
introduced by the new standard.  Let's still take complex number
support as an example.  When full C99 support is ready and gets
certain applications in the future (some people even argue if this
will be true, but I believe it), a user new to GSL may have already a
plenty of codes built on the standard complex type support and would
feel confused if GSL still uses current non-standard complex number
mechanism.  Such incompatiblities between GSL and standard would harm
the development of GSL and even cause divergence among potential
users.

-- 
HZ

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-04-15 15:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <b954b2060804090947j2574cf96y4ce9262b2fd55e77@mail.gmail.com>
2008-04-10 16:42 ` [Help-gsl] GSL and C99 standard Brian Gough
2008-04-10 19:19   ` Gerard Jungman
2008-04-11  8:00   ` Hongzheng Wang
2008-04-11 12:41   ` Heikki Orsila
2008-04-15 10:37     ` Brian Gough
2008-04-15 11:00       ` Heikki Orsila
2008-04-15 15:12         ` Hongzheng Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).