Results 1 to 3 of 3

Thread: Simple of static_cast

  1. #1
    Garcíarobine is offline Senior Member
    Join Date
    Dec 2009
    Posts
    334
    Rep Power
    3

    Default Simple of static_cast

    I am learning C++ language. I would like to know what the advantages of static_cast are. Because similar types are use in C type cast also. Can anybody solve this confusion? Any help would be highly appreciated.

  2. #2
    RodríguezBrown is offline Senior Member
    Join Date
    Dec 2009
    Posts
    322
    Rep Power
    3

    Default

    Using static_cast method you can convert type int to a char. But it has one disadvantage the resulting char does not have enough size to hold the entire value. It is very simple to use static_cast over, but you also ensure that static_cast not at all do a run time check and for this reason sometimes error are anonymous. There for use dynamic_cast instead of static_cast.

  3. #3
    WilsonMartin is offline Senior Member
    Join Date
    Dec 2009
    Posts
    319
    Rep Power
    3

    Default

    There are lots of advantages of static_cast over using c type cast but I have given sone of it.try to understand it.

    1. When you use static_cast method, then you are telling the user what you actually wanted to do.

    2. When you do not do daft things then compiler tells you that you have to perform daft things before proceeding.

Similar Threads

  1. Simple Silver - 1.0
    By ScottWright in forum Download Tools and Softwares
    Replies: 0
    Last Post: 04-08-2010, 09:14 AM
  2. Simple Way to Burn CDs
    By JacksonPerez in forum Hardware Jargons
    Replies: 0
    Last Post: 01-02-2010, 01:42 PM
  3. Circle simple c24
    By Zanetta Xever in forum other peripherals
    Replies: 0
    Last Post: 11-17-2009, 08:32 AM
  4. RSS- Really Simple Syndication
    By ahnel in forum Everything Else
    Replies: 0
    Last Post: 01-28-2009, 05:42 AM
  5. Replies: 0
    Last Post: 09-30-2008, 08:30 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48