linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* g++ without typecast
       [not found] <AANLkTi=GUjHMhXcWdaMbop+4f5Q9t549dOHECFvUAQtj@mail.gmail.com>
@ 2011-03-11 11:42 ` ratheesh k
  2011-03-11 12:23   ` ern0
  0 siblings, 1 reply; 2+ messages in thread
From: ratheesh k @ 2011-03-11 11:42 UTC (permalink / raw)
  To: linux-c-programming

This program will compile using gcc. But fails using g++ compiler ( we
need explicit type casting  here).

Is there any flag or anyother way thru which we could compile this
using g++ ( without explicit type cast )

#include <stdio.h>
int main()
{
     unsigned int addr=0xffff;
     int *ptr;
     ptr=addr;
     return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: g++ without typecast
  2011-03-11 11:42 ` g++ without typecast ratheesh k
@ 2011-03-11 12:23   ` ern0
  0 siblings, 0 replies; 2+ messages in thread
From: ern0 @ 2011-03-11 12:23 UTC (permalink / raw)
  To: linux-c-programming

On 03/11/2011 12:42 PM, ratheesh k wrote:
> Is there any flag or anyother way thru which we could compile this
> using g++ ( without explicit type cast )

AFAIK there's no syntax for define pointer constant values in the source 
code.

Don't afraid casting, it costs nothing. If you wanna use pointer 
constant values for special meanings, give them a name and #define it, 
just like NULL (which means "points to no object/struct/etc").
-- 
ern0
dataflow programmer

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-11 12:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <AANLkTi=GUjHMhXcWdaMbop+4f5Q9t549dOHECFvUAQtj@mail.gmail.com>
2011-03-11 11:42 ` g++ without typecast ratheesh k
2011-03-11 12:23   ` ern0

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).