Talk:c/language/cast

= Pointers <-> Integers =


 * There is a contradiction in the page text:


 * "Any integer can be cast to any pointer type." and "Any pointer type can be cast to any integer type."
 * "there are no conversions between pointers to functions and integers".


 * The Standard (6.3.2.3 Pointers, paragraphs 5 and 6) says "An integer may be converted to any pointer type." and "Any pointer type may be converted to an integer type."


 * Therefore, I think point 2 above should be removed from the page.


 * However, there is a very important point from the Standard (paragraph 6) which basically renders any sort of actually useful software completely impossible to write:


 * "Any pointer type may be converted to an integer type[&hellip;] The result need not be in the range of values of any integer type."


 * That fact should probably be noted somewhere.


 * The value of a pointer-to-function is going to be stored in some object, yet there is no dependable way to recover that value. Crazy!

97.116.53.9 16:54, 10 August 2021 (PDT)


 * Yes, i think you're right on the first one. As for result of conversion, the page already says it's implementation-defined (presumably all meaningful implementations defined it to something that is "actually useful") --Cubbi (talk) 19:56, 11 August 2021 (PDT)