conversion, promotion, exact match

Discussion in 'C++' started by Andy, Sep 7, 2005.

  1. Andy

    Andy Guest

    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
     
    Andy, Sep 7, 2005
    #1
    1. Advertising

  2. Andy

    Andy Guest

    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!
     
    Andy, Sep 10, 2005
    #2
    1. Advertising

  3. 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
     
    John Harrison, Sep 10, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wayne Shu
    Replies:
    2
    Views:
    278
    James Kanze
    Jul 29, 2007
  2. Neelesh Bodas

    Exact Match and Identity conversion

    Neelesh Bodas, Aug 8, 2007, in forum: C++
    Replies:
    17
    Views:
    722
  3. Mr.SpOOn
    Replies:
    4
    Views:
    512
    Lawrence D'Oliveiro
    Nov 4, 2008
  4. jimgardener

    finding an exact match of filenames

    jimgardener, Oct 16, 2010, in forum: Python
    Replies:
    1
    Views:
    280
    Peter Otten
    Oct 16, 2010
  5. John Butler

    search reg-exp for exact match

    John Butler, Nov 20, 2008, in forum: Ruby
    Replies:
    2
    Views:
    226
    Robert Klemme
    Nov 22, 2008
Loading...

Share This Page