Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #5168 > unrolled thread
| Started by | Ruben Safir <ruben@mrbrklyn.com> |
|---|---|
| First post | 2011-05-19 17:14 +0000 |
| Last post | 2011-05-23 15:13 +0000 |
| Articles | 6 — 5 participants |
Back to article view | Back to comp.lang.c++
Default constructor error Ruben Safir <ruben@mrbrklyn.com> - 2011-05-19 17:14 +0000
Re: Default constructor error Victor Bazarov <v.bazarov@comcast.invalid> - 2011-05-19 13:46 -0400
Re: Default constructor error Andrey Tarasevich <andreytarasevich@hotmail.com> - 2011-05-20 10:09 -0700
Re: Default constructor error Ruben Safir <mrbrklyn@panix.com> - 2011-05-20 23:37 +0000
Re: Default constructor error Victor Bazarov <v.bazarov@comcast.invalid> - 2011-05-21 13:25 -0400
Re: Default constructor error drew@furrfu.invalid (Drew Lawson) - 2011-05-23 15:13 +0000
| From | Ruben Safir <ruben@mrbrklyn.com> |
|---|---|
| Date | 2011-05-19 17:14 +0000 |
| Subject | Default constructor error |
| Message-ID | <ir3j67$486$2@reader1.panix.com> |
I'm getting this warning that appears in the 4.6 GCC compiler that didn't
happen before.
the warning is
/home/ruben/cplus/link_list_template_mysql/stats.h|45 col 42| warning:
converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
if comes from a default constructor
Distribution():freq(NULL), occurances(0){};
occurances is an int type, and the compiler is complaining about
occurances(0)
it goes away when I change it to
Distribution():freq(NULL){
occurances = 0;
};
but then it complains about freq which is of type T in a template
Ruben
[toc] | [next] | [standalone]
| From | Victor Bazarov <v.bazarov@comcast.invalid> |
|---|---|
| Date | 2011-05-19 13:46 -0400 |
| Message-ID | <ir3l2i$r9d$1@dont-email.me> |
| In reply to | #5168 |
On 5/19/2011 1:14 PM, Ruben Safir wrote:
> I'm getting this warning that appears in the 4.6 GCC compiler that didn't
> happen before.
>
> the warning is
>
> /home/ruben/cplus/link_list_template_mysql/stats.h|45 col 42| warning:
> converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
>
> if comes from a default constructor
>
> Distribution():freq(NULL), occurances(0){};
>
>
>
> occurances is an int type, and the compiler is complaining about
> occurances(0)
>
> it goes away when I change it to
>
> Distribution():freq(NULL){
> occurances = 0;
> };
>
>
> but then it complains about freq which is of type T in a template
Given some extrapolation in lieu of the information you didn't provide
(like the definition of the 'Distribution' class), it seems that the
compiler is just buggy. Have you tried a different version of the same
compiler, with the same -Wconversion-null option?
Take your code to the Comeau online compiler interface
(http://www.comeaucomputing.com/tryitout) and see if it compiles it
cleanly. Then, if the code is OK, file a bug report against GCC.
V
--
I do not respond to top-posted replies, please don't ask
[toc] | [prev] | [next] | [standalone]
| From | Andrey Tarasevich <andreytarasevich@hotmail.com> |
|---|---|
| Date | 2011-05-20 10:09 -0700 |
| Message-ID | <ir677e$t3e$1@dont-email.me> |
| In reply to | #5168 |
On 5/19/2011 10:14 AM, Ruben Safir wrote:
> I'm getting this warning that appears in the 4.6 GCC compiler that didn't
> happen before.
>
> the warning is
>
> /home/ruben/cplus/link_list_template_mysql/stats.h|45 col 42| warning:
> converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
>
> if comes from a default constructor
>
> Distribution():freq(NULL), occurances(0){};
>
>
>
> occurances is an int type, and the compiler is complaining about
> occurances(0)
What makes you think that it complains about `occurances` specifically?
My first guess would be that it is complaining about `freq(NULL)`.
> it goes away when I change it to
>
> Distribution():freq(NULL){
> occurances = 0;
> };
>
>
> but then it complains about freq which is of type T in a template
Well, again, my guess would be that the compiler was complaining about
`freq(NULL)` all the time. However, due to some quirk in the
implementation this version of the code does not produce the same
warning (even though the alleged issue is still there).
How is `freq` declared?
--
Best regards,
Andrey Tarasevich
[toc] | [prev] | [next] | [standalone]
| From | Ruben Safir <mrbrklyn@panix.com> |
|---|---|
| Date | 2011-05-20 23:37 +0000 |
| Message-ID | <ir6u09$or$2@reader1.panix.com> |
| In reply to | #5211 |
Andrey Tarasevich <andreytarasevich@hotmail.com> wrote:
> On 5/19/2011 10:14 AM, Ruben Safir wrote:
>> I'm getting this warning that appears in the 4.6 GCC compiler that didn't
>> happen before.
>>
>> the warning is
>>
>> /home/ruben/cplus/link_list_template_mysql/stats.h|45 col 42| warning:
>> converting to non-pointer type ?int? from NULL [-Wconversion-null]
>>
>> if comes from a default constructor
>>
>> Distribution():freq(NULL), occurances(0){};
>>
>>
>>
>> occurances is an int type, and the compiler is complaining about
>> occurances(0)
>
> What makes you think that it complains about `occurances` specifically?
> My first guess would be that it is complaining about `freq(NULL)`.
>
Because it says so specifically that the error is at occurances. It
says error at line# col#
>> it goes away when I change it to
>>
>> Distribution():freq(NULL){
>> occurances = 0;
>> };
>>
>>
>> but then it complains about freq which is of type T in a template
>
> Well, again, my guess would be that the compiler was complaining about
> `freq(NULL)` all the time.
No that analysis is wrong. The error message then changes and says it
is specifically and freq
> However, due to some quirk in the
> implementation this version of the code does not produce the same
> warning (even though the alleged issue is still there).
>
> How is `freq` declared?
>
the problem is not freq, as a fact.
Ruben
[toc] | [prev] | [next] | [standalone]
| From | Victor Bazarov <v.bazarov@comcast.invalid> |
|---|---|
| Date | 2011-05-21 13:25 -0400 |
| Message-ID | <ir8sj6$nqf$1@dont-email.me> |
| In reply to | #5225 |
On 5/20/2011 7:37 PM, Ruben Safir wrote:
> Andrey Tarasevich<andreytarasevich@hotmail.com> wrote:
>> On 5/19/2011 10:14 AM, Ruben Safir wrote:
>>> I'm getting this warning that appears in the 4.6 GCC compiler that didn't
>>> happen before.
>>>
>>> the warning is
>>>
>>> /home/ruben/cplus/link_list_template_mysql/stats.h|45 col 42| warning:
>>> converting to non-pointer type ?int? from NULL [-Wconversion-null]
>>>
>>> if comes from a default constructor
>>>
>>> Distribution():freq(NULL), occurances(0){};
>>>
>>>
>>>
>>> occurances is an int type, and the compiler is complaining about
>>> occurances(0)
>>
>> What makes you think that it complains about `occurances` specifically?
>> My first guess would be that it is complaining about `freq(NULL)`.
>>
>
> Because it says so specifically that the error is at occurances. It
> says error at line# col#
>
>>> it goes away when I change it to
>>>
>>> Distribution():freq(NULL){
>>> occurances = 0;
>>> };
>>>
>>>
>>> but then it complains about freq which is of type T in a template
>>
>> Well, again, my guess would be that the compiler was complaining about
>> `freq(NULL)` all the time.
>
> No that analysis is wrong. The error message then changes and says it
> is specifically and freq
>
>
>> However, due to some quirk in the
>> implementation this version of the code does not produce the same
>> warning (even though the alleged issue is still there).
>>
>> How is `freq` declared?
>>
>
> the problem is not freq, as a fact.
Or so you claim. Post the minimal _complete_ code that reproduces the
error.
V
--
I do not respond to top-posted replies, please don't ask
[toc] | [prev] | [next] | [standalone]
| From | drew@furrfu.invalid (Drew Lawson) |
|---|---|
| Date | 2011-05-23 15:13 +0000 |
| Message-ID | <irdti4$2qll$1@raid.furrfu.com> |
| In reply to | #5225 |
In article <ir6u09$or$2@reader1.panix.com>
Ruben Safir <mrbrklyn@panix.com> writes:
>Andrey Tarasevich <andreytarasevich@hotmail.com> wrote:
>> On 5/19/2011 10:14 AM, Ruben Safir wrote:
>>> I'm getting this warning that appears in the 4.6 GCC compiler that didn't
>>> happen before.
>>>
>>> the warning is
>>>
>>> /home/ruben/cplus/link_list_template_mysql/stats.h|45 col 42| warning:
>>> converting to non-pointer type ?int? from NULL [-Wconversion-null]
>>>
>>> if comes from a default constructor
>>>
>>> Distribution():freq(NULL), occurances(0){};
>>>
>>>
>>>
>>> occurances is an int type, and the compiler is complaining about
>>> occurances(0)
>>
>> What makes you think that it complains about `occurances` specifically?
>> My first guess would be that it is complaining about `freq(NULL)`.
>>
>
>Because it says so specifically that the error is at occurances. It
>says error at line# col#
That is where the compiler was looking when it determined that
something was wrong. Ideally, that is where the problem is, but
frequently it isn't. If the compiler tells me I have a problem on
line 25, I usually look at line 24.
Seeing as the error explicitly says "NULL," I'd look at the part
of the code that has "NULL."
--
Drew Lawson | What is an "Oprah"?
| -- Teal'c
|
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.c++
csiph-web