unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* 1.8.0:  C++-style cast
@ 2006-07-12  3:58 Mike Gran
  2006-07-12  8:20 ` Ludovic Courtès
  2006-07-13  1:48 ` Kevin Ryde
  0 siblings, 2 replies; 6+ messages in thread
From: Mike Gran @ 2006-07-12  3:58 UTC (permalink / raw)


In guile-core-1.8-20060711, in libguile/numbers.c, in
guile_ieee_init(), a C++ style cast is used instead of a C-style cast. 
Also, a declaration block occurs in a code block.  These bend the rules
of old-school ANSI C.

--- numbers.c.orig      2006-05-09 16:15:10.000000000 -0700
+++ numbers.c   2006-07-11 20:54:36.000000000 -0700
@@ -598,7 +598,7 @@
 #elif HAVE_DINFINITY
   /* OSF */
   extern unsigned int DINFINITY[2];
-  guile_Inf = (*(X_CAST(double *, DINFINITY)));
+  guile_Inf = (*((double *) (DINFINITY)));
 #else
   double tmp = 1e+10;
   guile_Inf = tmp;
@@ -619,9 +619,11 @@
   /* C99 NAN, when available */
   guile_NaN = NAN;
 #elif HAVE_DQNAN
-  /* OSF */
-  extern unsigned int DQNAN[2];
-  guile_NaN =  (*(X_CAST(double *, DQNAN)));
+  {
+    /* OSF */ 
+    extern unsigned int DQNAN[2];
+    guile_NaN = (*((double *)(DQNAN)));
+  }
 #else
   guile_NaN = guile_Inf / guile_Inf;
 #endif


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


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

* Re: 1.8.0:  C++-style cast
  2006-07-12  3:58 1.8.0: C++-style cast Mike Gran
@ 2006-07-12  8:20 ` Ludovic Courtès
  2006-07-21  0:34   ` Kevin Ryde
  2006-07-13  1:48 ` Kevin Ryde
  1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2006-07-12  8:20 UTC (permalink / raw)
  Cc: Bug Guile

Hi,

Mike Gran <spk121@yahoo.com> writes:

> In guile-core-1.8-20060711, in libguile/numbers.c, in
> guile_ieee_init(), a C++ style cast is used instead of a C-style cast. 
> Also, a declaration block occurs in a code block.  These bend the rules
> of old-school ANSI C.

I checked it and committed it to both 1.8 and HEAD.

Thanks!

Ludovic


PS to Kevin: Can you eventually merge into HEAD your recent fixes in 1.8?


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


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

* Re: 1.8.0:  C++-style cast
  2006-07-12  3:58 1.8.0: C++-style cast Mike Gran
  2006-07-12  8:20 ` Ludovic Courtès
@ 2006-07-13  1:48 ` Kevin Ryde
  2006-07-13  1:59   ` John W. Eaton
  2006-07-13  2:13   ` Mike Gran
  1 sibling, 2 replies; 6+ messages in thread
From: Kevin Ryde @ 2006-07-13  1:48 UTC (permalink / raw)
  Cc: bug-guile, John W. Eaton

Mike Gran <spk121@yahoo.com> writes:
>
> In guile-core-1.8-20060711, in libguile/numbers.c, in
> guile_ieee_init(), a C++ style cast is used instead of a C-style cast. 
> Also, a declaration block occurs in a code block.  These bend the rules
> of old-school ANSI C.
>
> -  guile_Inf = (*(X_CAST(double *, DINFINITY)));
> +  guile_Inf = (*((double *) (DINFINITY)));
>
> ...

I don't think it's c++.  I'm guessing X_CAST is an OSF macro.  Dunno
if it does anything good.  John Eaton contributed that, maybe he can
say (Cc'ed).


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


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

* Re: 1.8.0:  C++-style cast
  2006-07-13  1:48 ` Kevin Ryde
@ 2006-07-13  1:59   ` John W. Eaton
  2006-07-13  2:13   ` Mike Gran
  1 sibling, 0 replies; 6+ messages in thread
From: John W. Eaton @ 2006-07-13  1:59 UTC (permalink / raw)
  Cc: bug-guile, spikegran, John W. Eaton

On 13-Jul-2006, Kevin Ryde wrote:

| Mike Gran <spk121@yahoo.com> writes:
| >
| > In guile-core-1.8-20060711, in libguile/numbers.c, in
| > guile_ieee_init(), a C++ style cast is used instead of a C-style cast. 
| > Also, a declaration block occurs in a code block.  These bend the rules
| > of old-school ANSI C.
| >
| > -  guile_Inf = (*(X_CAST(double *, DINFINITY)));
| > +  guile_Inf = (*((double *) (DINFINITY)));
| >
| > ...
| 
| I don't think it's c++.  I'm guessing X_CAST is an OSF macro.  Dunno
| if it does anything good.  John Eaton contributed that, maybe he can
| say (Cc'ed).

Sorry, I extracted part of that code from Octave and X_CAST was a macro
used in the Octave source code that could expand to a C-style cast if
the C++ compiler did not yet support C++-style casts.  As for the
declaration mixed with code, well that is they way code is intended to
be written and I guess I forgot that I was writing C.  :-)

I'm guessing this was inside an #ifdef for a platform I no longer
have, so I didn't see warnings about it.

jwe


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


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

* Re: 1.8.0:  C++-style cast
  2006-07-13  1:48 ` Kevin Ryde
  2006-07-13  1:59   ` John W. Eaton
@ 2006-07-13  2:13   ` Mike Gran
  1 sibling, 0 replies; 6+ messages in thread
From: Mike Gran @ 2006-07-13  2:13 UTC (permalink / raw)
  Cc: bug-guile, John W. Eaton

--- Kevin Ryde <user42@zip.com.au> wrote:
> I don't think it's c++.  I'm guessing X_CAST is an OSF macro.  Dunno
> if it does anything good.  John Eaton contributed that, maybe he can
> say (Cc'ed).
> 
 
You're right.  When I googled for X_CAST, I came across this...

http://www.belgeler.org/autobook/autobook-Changeable-C--.html

which I didn't read too closely and took to understand that X_CAST was
C++ (which I don't use much.)  It also showed up in the Octave source,
which is C++, to reinforce my misperception.

For what it is worth, one of the strange machines I've been trying to
compile on (powerpc-ibm-aix4.3.3.0) has the code below in float.h and
math.h, which seems to align with the intent of the X_CAST in the guile
source.

extern  unsigned   int _DBLINF[2];
#define DINFINITY _DBLINF
#define DBL_INFINITY       (*((double *) (_DBLINF)))
#define DBL_QNAN   (*((double *) (DQNAN)))



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


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

* Re: 1.8.0:  C++-style cast
  2006-07-12  8:20 ` Ludovic Courtès
@ 2006-07-21  0:34   ` Kevin Ryde
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Ryde @ 2006-07-21  0:34 UTC (permalink / raw)


ludovic.courtes@laas.fr (Ludovic Courtès) writes:
>
> PS to Kevin: Can you eventually merge into HEAD your recent fixes in 1.8?

Yep.


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


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

end of thread, other threads:[~2006-07-21  0:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-12  3:58 1.8.0: C++-style cast Mike Gran
2006-07-12  8:20 ` Ludovic Courtès
2006-07-21  0:34   ` Kevin Ryde
2006-07-13  1:48 ` Kevin Ryde
2006-07-13  1:59   ` John W. Eaton
2006-07-13  2:13   ` Mike Gran

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).