473,396 Members | 1,849 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Variable name...

Greetings to everyone, this is my odd (probably trivial) question:
i defined that thing, like gobal var
....
int y1 = 0;
....
and at compile time i got
....
C:\Dati\Luigi\Progetti\provec++\plasma\SetPixel.cp p(42) : error C2373: 'y1'
: redefinition; different type modifiers
c:\programmi\microsoft visual studio\vc98\include\math.h(435) : see
declaration of 'y1'
....
then looked at the corresponding line in math.h, that is
....
_CRTIMP double __cdecl y1(double);
....
And i dont have any math.h include around.
Any hint? I'm under VC6, if it helps...
Thank to everyone who will reply me.
Luigi.

Jul 22 '05 #1
7 2269
"Il Maestro" <lu*************@spam.tiscali.it> wrote in
news:EH***********************@news3.tin.it:
Greetings to everyone, this is my odd (probably trivial) question:
i defined that thing, like gobal var
...
int y1 = 0;
...
and at compile time i got
...
C:\Dati\Luigi\Progetti\provec++\plasma\SetPixel.cp p(42) : error C2373:
'y1'
: redefinition; different type modifiers
c:\programmi\microsoft visual studio\vc98\include\math.h(435)
: see
declaration of 'y1'
...
then looked at the corresponding line in math.h, that is
...
_CRTIMP double __cdecl y1(double);
...
And i dont have any math.h include around.
Any hint? I'm under VC6, if it helps...
Thank to everyone who will reply me.
Luigi.


According to the documentation for VC7 (I don't have VC98, that is pretty
old for a C++ compiler), the functions _y0, _y1, and _yn(all with leading
underscores) compute Bessel functions. My copy of math.h shows these
functions both with and without leading underscore, depending on various
preprocessor definitions. I am not sure what exactly controls which is
selected, but maybe this will provide you with some insight.

Gregg
Jul 22 '05 #2

"Il Maestro" <lu*************@spam.tiscali.it> wrote in message
news:EH***********************@news3.tin.it...
Greetings to everyone, this is my odd (probably trivial) question:
i defined that thing, like gobal var
...
int y1 = 0;
...
and at compile time i got
...
C:\Dati\Luigi\Progetti\provec++\plasma\SetPixel.cp p(42) : error C2373: 'y1' : redefinition; different type modifiers
c:\programmi\microsoft visual studio\vc98\include\math.h(435) : see declaration of 'y1'
...
then looked at the corresponding line in math.h, that is
...
_CRTIMP double __cdecl y1(double);
...
And i dont have any math.h include around.
Any hint? I'm under VC6, if it helps...
Thank to everyone who will reply me.
Luigi.


VC6 only turns these names on if you have a macro defined, OLDNAMES I think
it is. So look at your compiler settings and turn that off if its on.

My memory might be playing tricks on me so if that isn't right ask in VC
group, for instance news:microsoft.public.vc.language

john
Jul 22 '05 #3
Il Maestro wrote:

Greetings to everyone, this is my odd (probably trivial) question:
i defined that thing, like gobal var
...
int y1 = 0;
...
and at compile time i got
...
C:\Dati\Luigi\Progetti\provec++\plasma\SetPixel.cp p(42) : error C2373: 'y1'
: redefinition; different type modifiers
c:\programmi\microsoft visual studio\vc98\include\math.h(435) : see
declaration of 'y1'
...
then looked at the corresponding line in math.h, that is
...
_CRTIMP double __cdecl y1(double);
...
And i dont have any math.h include around.
Any hint? I'm under VC6, if it helps...
Thank to everyone who will reply me.
Luigi.


Bessel functions j0, j1, jn, y0, y1, yn are quite common, not only
with MS libraries. Some other header included <math.h>, where they
were declared; e.g., <iostream> does that for me.

It pays to just avoid using simple short names like the above in the
/global scope/ (actually, any names if there is no good reason to the
contrary). Put them into a namespace; an unnamed namespace if you
only need them in a given unit.

Denis
Jul 22 '05 #4
"John Harrison" <jo*************@hotmail.com> wrote in message
news:2h************@uni-berlin.de

VC6 only turns these names on if you have a macro defined, OLDNAMES I
think it is. So look at your compiler settings and turn that off if
its on.

My memory might be playing tricks on me so if that isn't right ask in
VC group, for instance news:microsoft.public.vc.language

Header files are a pain in the neck to interpret in terms of #ifdefs and
such, but it appears that y1 and the rest typically ARE defined.

The main case in which this is NOT true is when the /Za (disable extensions)
compiler switch is set AND it is a C file that is being compiled.

If it is a C++ file, then (with or without /Za) y1 is defined and the
problem arises. It seems that the only practical solution is to NOT have a
variable named y1 (or y0 or yn or a few other things) at global scope.
--
John Carson
1. To reply to email address, remove donald
2. Don't reply to email address (post here instead)

Jul 22 '05 #5
Ok, i got the point...
I think i'll follow the namespace advice, because i find ilarious i cant use
such a useful name....
Thank to everyone ;)
Jul 22 '05 #6
Denis Remezov <RE*********************@yahoo.removethis.ca> wrote:

Bessel functions j0, j1, jn, y0, y1, yn are quite common, not only
with MS libraries. Some other header included <math.h>, where they
were declared; e.g., <iostream> does that for me.


<iostream> ought to only include <cmath> (or not include either, of course).
If you get y1 in the global namespace as a result of including iostream,
then a compiler upgrade is probably in order.

(Add this one to the list of reasons not to go "using namespace std;")
Jul 22 '05 #7
Old Wolf wrote:

Denis Remezov <RE*********************@yahoo.removethis.ca> wrote:

Bessel functions j0, j1, jn, y0, y1, yn are quite common, not only
with MS libraries. Some other header included <math.h>, where they
were declared; e.g., <iostream> does that for me.


<iostream> ought to only include <cmath> (or not include either, of course).
If you get y1 in the global namespace as a result of including iostream,
then a compiler upgrade is probably in order.


Yes that was what happened. On the hand, y1 is not a standard function,
so placing it in the std namespace would not be the right thing, I assume.

Denis
Jul 22 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Scott | last post by:
I have an XML Document in a format like: <Variable name="Bob">ABCDEFG</Variable> <Variable name="Steve">QWERTYUI</Variable> <Variable name="John">POIUYTR</Variable> <Variable...
2
by: Bradford | last post by:
Question for the masses... Lets say I have variable with the following contents "aaaa bbbb ccccc dddd". The format is not specific and the space delimiter could be changed to any other. How...
4
by: Frederik Sørensen | last post by:
I include a xslt stylesheet with variables for all the error messages in my system. <xsl:variable name="Banner_error_1"> errormessage 1 for banner </xsl:variable> <xsl:variable...
134
by: James A. Donald | last post by:
I am contemplating getting into Python, which is used by engineers I admire - google and Bram Cohen, but was horrified to read "no variable or argument declarations are necessary." Surely that...
166
by: Graham | last post by:
This has to do with class variables and instances variables. Given the following: <code> class _class: var = 0 #rest of the class
23
by: Russ Chinoy | last post by:
Hi, This may be a totally newbie question, but I'm stumped. If I have a function such as: function DoSomething(strVarName) { ..... }
20
by: weston | last post by:
I've got a piece of code where, for all the world, it looks like this fails in IE 6: hometab = document.getElementById('hometab'); but this succeeds: hometabemt =...
3
by: rls03 | last post by:
I have the following which creates a variable containing a relative path where <xsl:value-of select="."/returns a portion of the filename: <xsl:variable...
2
by: Kevin | last post by:
I am having difficulty updating a variable page-time-stamp in the following snippit. The variable time-stamp is initialized from the attribute time-stamp from the log element. Some of the page...
2
by: Looch | last post by:
All, I'm trying to output but I can only get (brackets for clarity) when using the code below. How can I "break" into the query variable in the InsertName method to add the name parameter to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.