473,379 Members | 1,185 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.

conversion, promotion, exact match

Hi...

i'm trying to understand the concept of function name overloading in
c++.
to understand the resolving system it's important to understand the
diffrent
levels of typecasting (exact match, promotion, conversion, not
possible)

that is, what i don't really understand. so i tried do make a little
table:

| bool | char | unsig int | int | float | double
-----------------------------------------------------------
bool into | EM | PRO | PRO | PRO | |
-----------------------------------------------------------
char into | | EM | PRO | PRO | PRO | PRO
-----------------------------------------------------------
unsig into | | | EM | | |
-----------------------------------------------------------
int into | CON | CON | | EM | CON | CON
-----------------------------------------------------------
float into | | | | | EM | PRO
-----------------------------------------------------------
double into| CON | | | | | EM

(e.g.: float into double: PRO)
EM= exakt match
PRO= promotion
CON= conversion
NP= not possible

it would be a great help for me if someone could correct and complete
this table.

thanks a lot...

andy

Sep 7 '05 #1
2 2142

Andy schrieb:
Hi...

i'm trying to understand the concept of function name overloading in
c++.
to understand the resolving system it's important to understand the
diffrent
levels of typecasting (exact match, promotion, conversion, not
possible)

that is, what i don't really understand. so i tried do make a little
table:

| bool | char | unsig int | int | float | double
-----------------------------------------------------------
bool into | EM | PRO | PRO | PRO | |
-----------------------------------------------------------
char into | | EM | PRO | PRO | PRO | PRO
-----------------------------------------------------------
unsig into | | | EM | | |
-----------------------------------------------------------
int into | CON | CON | | EM | CON | CON
-----------------------------------------------------------
float into | | | | | EM | PRO
-----------------------------------------------------------
double into| CON | | | | | EM

(e.g.: float into double: PRO)
EM= exakt match
PRO= promotion
CON= conversion
NP= not possible

it would be a great help for me if someone could correct and complete
this table.


sorry for being impatient, but i'm just wondering why nobody answers to
my post.
is it useless to make a table like intended to do, or did i violate a
rule and my post is not as post need to be in this group?

please answer me!

Sep 10 '05 #2
Andy wrote:
Andy schrieb:

Hi...

i'm trying to understand the concept of function name overloading in
c++.
to understand the resolving system it's important to understand the
diffrent
levels of typecasting (exact match, promotion, conversion, not
possible)

that is, what i don't really understand. so i tried do make a little
table:

| bool | char | unsig int | int | float | double
-----------------------------------------------------------
bool into | EM | PRO | PRO | PRO | |
-----------------------------------------------------------
char into | | EM | PRO | PRO | PRO | PRO
-----------------------------------------------------------
unsig into | | | EM | | |
-----------------------------------------------------------
int into | CON | CON | | EM | CON | CON
-----------------------------------------------------------
float into | | | | | EM | PRO
-----------------------------------------------------------
double into| CON | | | | | EM

(e.g.: float into double: PRO)
EM= exakt match
PRO= promotion
CON= conversion
NP= not possible

it would be a great help for me if someone could correct and complete
this table.

sorry for being impatient, but i'm just wondering why nobody answers to
my post.
is it useless to make a table like intended to do, or did i violate a
rule and my post is not as post need to be in this group?

please answer me!


You didn't violate any rules, I guess no-one found your topic
interesting or important enough to answer.

The C++ standard actually allows some leeway to implementors so I don't
think you can write one table that would work for all implementations.
For instance char -> unsigned int is a conversion if char is signed but
a promotion if char is unsigned.

Your table has some mistakes, bool to char is a conversion for instance,
There are no promotions to char. char to unsigned int may be a promotion
or a conversion, as explained above.

All the blanks in your table are conversions.

Hopefully that gives you enough information to complete the table.

john
Sep 10 '05 #3

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

Similar topics

7
by: Michael Lehn | last post by:
Hi, I have a question regarding the conversion of objects. When is the conversion done by the constructor and when by the operator. My feeling tells me that the constructor is preferred. But...
2
by: conrad | last post by:
for something like printf("%lld\n", 1); what section in the standard describes what type the argument "1" is promoted to? All I see is a section describing promotion from float to double but...
16
by: TTroy | last post by:
Hello, I'm relatively new to C and have gone through more than 4 books on it. None mentioned anything about integral promotion, arithmetic conversion, value preserving and unsigned preserving. ...
11
by: Steve Gough | last post by:
Could anyone please help me to understand what is happening here? The commented line produces an error, which is what I expected given that there is no conversion defined from type double to type...
2
by: Arvid Requate | last post by:
Hello, I'd like to understand why the following code does not compile. It looks like a strangeness in connection with overload resolution for the <complex> header: The conversion operator...
0
by: ReeceSeeSharp | last post by:
Having difficulty trying to get this code in .NET (C#) to print out this string EXACTLY as it prints out within Java using a) the MD5 hashing algorithm and B). In Java here's how a string "ididnot"...
6
by: sarathy | last post by:
Hi, What is integer promotion? How is it different from arithmetic conversion? Regards, Sarathy
1
by: Neelesh Bodas | last post by:
Can somebody please explain the fine difference between these two clauses of the standard: 4.5 (Integral promotions) 4. An rvalue of type bool can be converted to an rvalue of type int, with...
6
by: Rahul | last post by:
Hi Everyone, I have the following code, class B; class A { public : operator B();
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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: 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...

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.