Question to someone from ISE

7 Messages Forum Options Options
Permalink
Chris Saunders-4
Question to someone from ISE
Reply Threaded More
Print post
Permalink
Thinking about making a bug report on this but am not entirely sure.  I was
working on a class to interface to the constants from math.h.  Here are the
two functions that compile correctly:

 

 

                Huge: REAL_64 is

                                                -- maximum value of a
double.

                                external

                                                "C inline use <math.h>"

                                alias

                                                "return HUGE;"

                                end

 

 

                Huge_val: REAL_64 is

                                                -- Positive infinity.

                                external

                                                "C inline use <math.h>"

                                alias

                                                "return HUGE_VAL;"

                                end

 

here is one that fails on C compilation:

 

                M_log2e: REAL_64 is

                                                -- Base-2 logarithm of e.

                                external

                                                "C inline use <math.h>"

                                alias

                                                "return M_LOG2E;"

                                end

 

Actually the rest fail to C compile as well but I'm trying to keep this
short.

Here's the message from the C compiler:

 

c:\users\saunders\documents\eiffel 6.2 user
files\projects\mandolin3\eifgens\mandolin3_project\w_code\c4\ma2007.c(47) :
error C2065: 'M_E' : undeclared identifier

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\Bin\amd64\cl.EXE"' : return code '0x2'

Stop.

 

Does it appear that I should make a bug report for this?

 

Regards

Chris Saunders



[Non-text portions of this message have been removed]


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/eiffel_software/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/eiffel_software/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:eiffel_software-digest@...
    mailto:eiffel_software-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    eiffel_software-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Eric Bezault
Re: Question to someone from ISE
Reply Threaded More
Print post
Permalink
Chris Saunders wrote:

>                 M_log2e: REAL_64 is
>
>                                                 -- Base-2 logarithm of e.
>
>                                 external
>
>                                                 "C inline use <math.h>"
>
>                                 alias
>
>                                                 "return M_LOG2E;"
>
>                                 end
>
> c:\users\saunders\documents\eiffel 6.2 user
> files\projects\mandolin3\eifgens\mandolin3_project\w_code\c4\ma2007.c(47) :
> error C2065: 'M_E' : undeclared identifier

It looks like there is a declaration somewhere of the form:

#define LOG2

If this is indeed the case, then M_LOG2E might be expanded to M_E.

--
Eric Bezault
mailto:ericb@...
http://www.gobosoft.com

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/eiffel_software/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/eiffel_software/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:eiffel_software-digest@...
    mailto:eiffel_software-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    eiffel_software-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Chris Saunders-4
RE: Question to someone from ISE
Reply Threaded More
Print post
Permalink
In reply to this post by Chris Saunders-4
I'm resending this message because my original was inaccurate.  I have been
writing an interface the math constants from math.h - I'm testing out
methods of using  "C inline".  Only 2  of the functions compiled:

 

 

                Huge: REAL_64 is

                                                -- maximum value of a
double.

                                external

                                                "C inline use <math.h>"

                                alias

                                                "return HUGE;"

                                end

 

 

                Huge_val: REAL_64 is

                                                -- Positive infinity.

                                external

                                                "C inline use <math.h>"

                                alias

                                                "return HUGE_VAL;"

                                end

 

Here is one that did not compile:

 

 

                M_e: REAL_64 is

                                                -- Base of natural
logarithms (e).

                                external

                                                "C inline use <math.h>"

                                alias

                                                "return M_E;"

 

Here is the error message from the C compiler:

 

c:\users\saunders\documents\eiffel 6.2 user
files\projects\mandolin3\eifgens\mandolin3_project\w_code\c4\ma2007.c(47) :
error C2065: 'M_E' : undeclared identifier

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\Bin\amd64\cl.EXE"' : return code '0x2'

Stop.

 

All three functions appear to be written correctly.  In my code I also
included all of the other constants from math.h and they got similar errors
from the C compiler, I just commented out all the others that failed and
froze so I could keep this short.  My apologies to Eric Bezault, who
responded to the original message, because of the error.

 

Does this suggest there is some kind of bug in EiffelStudio?

 

Regards

Chris Saunders



[Non-text portions of this message have been removed]


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/eiffel_software/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/eiffel_software/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:eiffel_software-digest@...
    mailto:eiffel_software-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    eiffel_software-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

David Broadfoot
RE: Question to someone from ISE
Reply Threaded More
Print post
Permalink
In reply to this post by Eric Bezault
The C pre-processor doesn't work like that: it does tokenization before
it does macro expansion... it only matches whole tokens.

Otherwise, the C pre-processor would be an even bigger nightmare than it
already is!

David




> It looks like there is a declaration somewhere of the form:
>
> #define LOG2
>
> If this is indeed the case, then M_LOG2E might be expanded to M_E.
>
> --
> Eric Bezault
> mailto:ericb@...
> http://www.gobosoft.com



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/eiffel_software/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/eiffel_software/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:eiffel_software-digest@...
    mailto:eiffel_software-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    eiffel_software-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Eric Bezault
Re: Question to someone from ISE
Reply Threaded More
Print post
Permalink
David Broadfoot wrote:
> The C pre-processor doesn't work like that: it does tokenization before
> it does macro expansion... it only matches whole tokens.
>
> Otherwise, the C pre-processor would be an even bigger nightmare than it
> already is!

That seemed weird to me indeed, but I could not find a better
explanation to explain that M_LOG2E was suddenly interpreted
as M_E. Now we know that Chris made a typo.

In any case, we're better off programming in Eiffel ;-)

--
Eric Bezault
mailto:ericb@...
http://www.gobosoft.com

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/eiffel_software/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/eiffel_software/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:eiffel_software-digest@...
    mailto:eiffel_software-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    eiffel_software-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Chris Saunders-4
RE: Question to someone from ISE
Reply Threaded More
Print post
Permalink
I whole heartedly agree that we're better off programming in Eiffel.
However "C inline" is part of Eiffel now and I was trying to sharpen my
skills with it - too bad I'm not a better C programmer.  I found the problem
with those macros from math.h - in Microsofts version if you include a
#define of some macro in your code(I forget its name) then you can use these
constants.  I don't know if this is possible to do with EiffelStudio.

 

Regards

Chris Saunders

 

From: eiffel_software@...
[mailto:eiffel_software@...] On Behalf Of Eric Bezault
Sent: Sunday, July 06, 2008 1:09 PM
To: eiffel_software@...
Subject: Re: [eiffel_software] Question to someone from ISE

 

David Broadfoot wrote:
> The C pre-processor doesn't work like that: it does tokenization before
> it does macro expansion... it only matches whole tokens.
>
> Otherwise, the C pre-processor would be an even bigger nightmare than it
> already is!

That seemed weird to me indeed, but I could not find a better
explanation to explain that M_LOG2E was suddenly interpreted
as M_E. Now we know that Chris made a typo.

In any case, we're better off programming in Eiffel ;-)

--
Eric Bezault
mailto:ericb@... <mailto:ericb%40gobosoft.com>
http://www.gobosoft.com

 



[Non-text portions of this message have been removed]


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/eiffel_software/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/eiffel_software/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:eiffel_software-digest@...
    mailto:eiffel_software-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    eiffel_software-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Emmanuel Stapf
RE: Question to someone from ISE
Reply Threaded More
Print post
Permalink
The best way to do that is to add ". -D_USE_MATH_DEFINES" as an external include
of your project.

Regards,
Manu

> -----Original Message-----
> From: eiffel_software@...
> [mailto:eiffel_software@...] On Behalf Of Chris Saunders
> Sent: Sunday, July 06, 2008 5:20 PM
> To: eiffel_software@...
> Subject: RE: [eiffel_software] Question to someone from ISE
>
> I whole heartedly agree that we're better off programming in Eiffel.
> However "C inline" is part of Eiffel now and I was trying to sharpen my
> skills with it - too bad I'm not a better C programmer.  I found the
> problem
> with those macros from math.h - in Microsofts version if you include a
> #define of some macro in your code(I forget its name) then you can use
> these
> constants.  I don't know if this is possible to do with EiffelStudio.
>
>
>
> Regards
>
> Chris Saunders
>
>
>
> From: eiffel_software@...
> [mailto:eiffel_software@...] On Behalf Of Eric Bezault
> Sent: Sunday, July 06, 2008 1:09 PM
> To: eiffel_software@...
> Subject: Re: [eiffel_software] Question to someone from ISE
>
>
>
> David Broadfoot wrote:
> > The C pre-processor doesn't work like that: it does tokenization before
> > it does macro expansion... it only matches whole tokens.
> >
> > Otherwise, the C pre-processor would be an even bigger nightmare than
> it
> > already is!
>
> That seemed weird to me indeed, but I could not find a better
> explanation to explain that M_LOG2E was suddenly interpreted
> as M_E. Now we know that Chris made a typo.
>
> In any case, we're better off programming in Eiffel ;-)
>
> --
> Eric Bezault
> mailto:ericb@... <mailto:ericb%40gobosoft.com>
> http://www.gobosoft.com
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/eiffel_software/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/eiffel_software/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:eiffel_software-digest@...
    mailto:eiffel_software-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    eiffel_software-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

------------------------------------------------------------------------  
Eiffel Software
805-685-1006
http://www.eiffel.com       
Customer support: http://support.eiffel.com       
User group: http://groups.eiffel.com/join       
------------------------------------------------------------------------