Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > weird warning with g++ 4.1

Reply
Thread Tools

weird warning with g++ 4.1

 
 
Rolf Magnus
Guest
Posts: n/a
 
      09-27-2006
Sam Steingold wrote:

>> * mlimber <(E-Mail Removed)> [2006-09-27 09:16:44 -0700]:
>>
>>> so, I should have formulated my question like this: how do I modify
>>> as_chart so that g++ 4.1.1 will accept it?

>>
>> Get rid of the one_c:{c} business. That's the problem.

>
> I don't have "one_c:{c}".
> I have "((chart){one_cc)})".



Seems to me like the same, just with a cast in front of it.

> what do I replace it with?


That depends on what it's supposed to do.

 
Reply With Quote
 
 
 
 
Sam Steingold
Guest
Posts: n/a
 
      09-27-2006
> * Rolf Magnus <(E-Mail Removed)> [2006-09-27 19:24:54 +0200]:
>
> Sam Steingold wrote:
>
>>> * mlimber <(E-Mail Removed)> [2006-09-27 09:16:44 -0700]:
>>>
>>>> so, I should have formulated my question like this: how do I modify
>>>> as_chart so that g++ 4.1.1 will accept it?
>>>
>>> Get rid of the one_c:{c} business. That's the problem.

>>
>> what do I replace it with?

>
> That depends on what it's supposed to do.


convert an integer to a structure:

typedef struct { int one_c; } chart;
#define as_chart(c) ((chart){one_cc)})

as_chart should convert an integer to a struct.


--
Sam Steingold (http://www.podval.org/~sds) on Fedora Core release 5 (Bordeaux)
http://iris.org.il http://mideasttruth.com http://israelunderattack.slide.com
http://honestreporting.com http://dhimmi.com http://jihadwatch.org
The world is coming to an end. Please log off.
 
Reply With Quote
 
 
 
 
Nate Barney
Guest
Posts: n/a
 
      09-27-2006
Sam Steingold wrote:
>> * Rolf Magnus <(E-Mail Removed)> [2006-09-27 19:24:54 +0200]:
>>
>> Sam Steingold wrote:
>>
>>>> * mlimber <(E-Mail Removed)> [2006-09-27 09:16:44 -0700]:
>>>>
>>>>> so, I should have formulated my question like this: how do I modify
>>>>> as_chart so that g++ 4.1.1 will accept it?
>>>> Get rid of the one_c:{c} business. That's the problem.
>>> what do I replace it with?

>> That depends on what it's supposed to do.

>
> convert an integer to a structure:
>
> typedef struct { int one_c; } chart;
> #define as_chart(c) ((chart){one_cc)})
>
> as_chart should convert an integer to a struct.
>


How about:

struct chart { chart() {} chart(int c) : one_c(c) {} int one_c; };
inline chart as_chart(int c) { return chart(c); }
 
Reply With Quote
 
Sam Steingold
Guest
Posts: n/a
 
      09-27-2006
> * Nate Barney <(E-Mail Removed)> [2006-09-27 13:58:26 -0400]:
>
> Sam Steingold wrote:
>>> * Rolf Magnus <(E-Mail Removed)> [2006-09-27 19:24:54 +0200]:
>>>
>>> Sam Steingold wrote:
>>>
>>>>> * mlimber <(E-Mail Removed)> [2006-09-27 09:16:44 -0700]:
>>>>>
>>>>>> so, I should have formulated my question like this: how do I modify
>>>>>> as_chart so that g++ 4.1.1 will accept it?
>>>>> Get rid of the one_c:{c} business. That's the problem.
>>>> what do I replace it with?
>>> That depends on what it's supposed to do.

>>
>> convert an integer to a structure:
>>
>> typedef struct { int one_c; } chart;
>> #define as_chart(c) ((chart){one_cc)})
>>
>> as_chart should convert an integer to a struct.
>>

>
> How about:
>
> struct chart { chart() {} chart(int c) : one_c(c) {} int one_c; };
> inline chart as_chart(int c) { return chart(c); }


this works, thanks!

--
Sam Steingold (http://www.podval.org/~sds) on Fedora Core release 5 (Bordeaux)
http://mideasttruth.com http://palestinefacts.org http://jihadwatch.org
http://truepeace.org http://israelnorthblog.livejournal.com http://iris.org.il
You think Oedipus had a problem -- Adam was Eve's mother.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: A Weird Appearance for a Weird Site David Segall HTML 0 01-22-2011 04:50 AM
Re: A Weird Appearance for a Weird Site Beauregard T. Shagnasty HTML 1 01-21-2011 04:17 PM
Re: A Weird Appearance for a Weird Site richard HTML 0 01-21-2011 07:10 AM
Re: A Weird Appearance for a Weird Site dorayme HTML 1 01-21-2011 06:51 AM
Re: A Weird Appearance for a Weird Site richard HTML 0 01-21-2011 06:46 AM



Advertisments