473,379 Members | 1,257 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,379 software developers and data experts.

warning question (C4114)

1>e:\development\root\root\vector3.h(24) : warning C4114: same type
qualifier used more than once
1>e:\development\root\root\vector3.h(24) : warning C4114: same type
qualifier used more than once
1>e:\development\root\root\vector3.h(82) : warning C4114: same type
qualifier used more than once

line 24: Vector3( const Vector3 const * v );
line 82: inline Vector3::Vector3( const Vector3 const * v )

Ok I get that it is because I use const twice.
But I learned that it has to be done like that =s.

The first const is for making sure the object cannot be changed and
the second one so the pointer cannot be changed. So is this a
misinterpretation of mine? Or is there something else.
May 31 '08 #1
5 4304

<mi**************@gmail.coma écrit dans le message de news:
ce**********************************...oglegroups.com...
>1>e:\development\root\root\vector3.h(24) : warning C4114: same type
qualifier used more than once
1>e:\development\root\root\vector3.h(24) : warning C4114: same type
qualifier used more than once
1>e:\development\root\root\vector3.h(82) : warning C4114: same type
qualifier used more than once

line 24: Vector3( const Vector3 const * v );
line 82: inline Vector3::Vector3( const Vector3 const * v )

Ok I get that it is because I use const twice.
But I learned that it has to be done like that =s.

The first const is for making sure the object cannot be changed and
the second one so the pointer cannot be changed. So is this a
misinterpretation of mine? Or is there something else.

try

Vector3( const Vector3 * const v );

const can be used on either side of Vector3 so

Vector3( const Vector3 v );
is the same as
Vector3(Vector3 const v );

so
Vector3( const Vector3 *v );
is the same as
Vector3( Vector3 const * v );
so writting
Vector3( const Vector3 const * v );
is redundant
May 31 '08 #2
aaah thanks

so i should have done

Vector3(Vector3 cosnt * const v) or Vector3(const Vector3 * const v)

yeah sounds logical if you think about it :).
May 31 '08 #3
On 2008-05-31 15:41, mi**************@gmail.com wrote:
aaah thanks

so i should have done

Vector3(Vector3 cosnt * const v) or Vector3(const Vector3 * const v)

yeah sounds logical if you think about it :).
You should read declarations backwards:

int const * ptr

ptr is a pointer to a constant int

and

int * const ptr

ptr is a constant pointer to an int

and finally

int const * const ptr

ptr is a constant pointer to a constant int

--
Erik Wikström
May 31 '08 #4
On May 31, 3:07 pm, "michael.gooss...@gmail.com"
<michael.gooss...@gmail.comwrote:
1>e:\development\root\root\vector3.h(24) : warning C4114: same type
qualifier used more than once
1>e:\development\root\root\vector3.h(24) : warning C4114: same type
qualifier used more than once
1>e:\development\root\root\vector3.h(82) : warning C4114: same type
qualifier used more than once
line 24: Vector3( const Vector3 const * v );
line 82: inline Vector3::Vector3( const Vector3 const * v )
Ok I get that it is because I use const twice.
But I learned that it has to be done like that =s.
The first const is for making sure the object cannot be
changed and the second one so the pointer cannot be changed.
So is this a misinterpretation of mine? Or is there something
else.
It's a misinterpretation of yours. Generally speaking, const
modifies what precedes it, so Vector3 const* is a non-const
pointer to a const Vector3, Vector3 *const is a const pointer to
a non-const Vector3, and Vector3 const *const is a const pointer
to a const Vector3.

For historical reasons, if nothing precedes the const, then it
applies to whatever follows, so const Vector3 * is the same as
Vector3 const*. It's probably best to always put the const
after, however, and avoid confusion.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
May 31 '08 #5
LR
Erik Wikström wrote:
You should read declarations backwards:
Wouldn't it be better to use the right left rule?
>
int const * ptr

ptr is a pointer to a constant int
[snip]

How would you apply your suggestion to this?

int *p[];

LR

Jun 1 '08 #6

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

Similar topics

3
by: Bas Wassink | last post by:
Hello there, I'm having trouble understanding a warning produced by 'splint', a code-checker. The warning produced is: keywords.c: (in function keyw_get_string) keywords.c:60:31: Released...
3
by: Bill Burris | last post by:
How do I find what is causing this warning from the Linker? If I use /NODEFAULTLIB I get hundreds of undefined symbols. LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other...
3
by: DJTN | last post by:
I'm getting the following error when I try to compile my setup project in VS 2002. I have re-installed the .net framework 1.1 and it didnt solve the problem. WARNING: Unable to find dependency...
1
by: spanov | last post by:
i've got problem installing python-2.3.5 from sources on FreeBSD 5.3 root@server# ./configure > conf_log configure: WARNING: curses.h: present but cannot be compiled configure: WARNING:...
0
by: Manish | last post by:
PHP INI File Setting ------------------------------------------------------------------------------------------------------------------ error_reporting = E_ALL & ~E_NOTICE No warning message are...
1
by: Ian | last post by:
I've just discovered the msclr::lock class in the C++ Support Library online documentation. This seems like a much cleaner way to implement thread protection than using...
92
by: Heinrich Pumpernickel | last post by:
what does this warning mean ? #include <stdio.h> int main() { long l = 100; printf("l is %li\n", l * 10L);
4
by: cody | last post by:
It is possible to declare and use/instantiate a class with a uninitialized readonly field without even a compiler warning. Why don't I get warnings? public class Stuff { public readonly int a;...
5
by: michael.goossens | last post by:
1>e:\development\root\root\vector3.h(24) : warning C4114: same type qualifier used more than once 1>e:\development\root\root\vector3.h(24) : warning C4114: same type qualifier used more than once...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.