473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Solaris is complaining about the following

static char* nullStr = "null";
This line in the solaris mode64 ( cc -m64 flag, gives out the
following warning message )

"virvpirw.cc", line 371: Warning: String literal converted to char* in
initialization.
1 Warning(s) detected.

Now our builds are strict and dont allow this warning too in the
building. Can we remove this by any other way.

Sep 28 '07 #1
13 2176
pa********@hotmail.com wrote:
static char* nullStr = "null";
This line in the solaris mode64 ( cc -m64 flag, gives out the
following warning message )

"virvpirw.cc", line 371: Warning: String literal converted to char* in
initialization.
1 Warning(s) detected.

Now our builds are strict and dont allow this warning too in the
building. Can we remove this by any other way.
Two-and-a-half suggestions:

1) static const char* nullStr = "null";

2) Use a C compiler rather than a C++ compiler.

2a) ... or take further questions to comp.lang.c++

--
Eric Sosman
es*****@ieee-dot-org.invalid
Sep 28 '07 #2

<pa********@hotmail.comwrote in message
news:11**********************@50g2000hsm.googlegro ups.com...
static char* nullStr = "null";
Now our builds are strict and dont allow this warning too in the
building. Can we remove this by any other way.
static char nullStr[] = "null";

Sep 28 '07 #3
Eric Sosman wrote, On 28/09/07 13:10:
pa********@hotmail.com wrote:
> static char* nullStr = "null";
This line in the solaris mode64 ( cc -m64 flag, gives out the
following warning message )

"virvpirw.cc", line 371: Warning: String literal converted to char* in
initialization.
1 Warning(s) detected.

Now our builds are strict and dont allow this warning too in the
building. Can we remove this by any other way.

Two-and-a-half suggestions:

1) static const char* nullStr = "null";
Yes.
2) Use a C compiler rather than a C++ compiler.

2a) ... or take further questions to comp.lang.c++
cc on most versions of Unix *is* a C compiler, at least when fed a file
with a name ending in ".c". Since the warning is about a string literal
being converted to char* I see no reason to assume the OP was compiling
as C++, although I would say the warning is badly worded.
--
Flash Gordon
Sep 28 '07 #4
On Fri, 28 Sep 2007 21:41:05 +0100, Flash Gordon wrote:
Eric Sosman wrote, On 28/09/07 13:10:
>pa********@hotmail.com wrote:
>>Now our builds are strict and dont allow this warning too in the
building. Can we remove this by any other way.

Two-and-a-half suggestions:

1) static const char* nullStr = "null";

Yes.
> 2) Use a C compiler rather than a C++ compiler.

2a) ... or take further questions to comp.lang.c++

cc on most versions of Unix *is* a C compiler, at least when fed a file
with a name ending in ".c".
cc on most versions of Unix is *not* a C compiler, but a C-like compiler.
Possibly, it will include options to cause it to conform to the C
standard, but typically this is not the default.
Since the warning is about a string literal
being converted to char* I see no reason to assume the OP was compiling
as C++,
Neither do I, but...
although I would say the warning is badly worded.
some not fully conforming implementations give string literals the type
const char []
rather than the unqualified version the standard requires. On those
implementations, the warning is correct. I do not know if this is the
case on this specific implementation, but it's very well possible.
Sep 28 '07 #5
Flash Gordon wrote:

[...]
cc on most versions of Unix *is* a C compiler
The Single UNIX ® Specification, Version 2:

NAME
c89 - compile standard C programs

--
Tor <torust [at] online [dot] no>
"I have stopped reading Stephen King novels. Now I just read C code instead"
Sep 28 '07 #6
Flash Gordon wrote:
>
cc on most versions of Unix *is* a C compiler, at least when fed a file
with a name ending in ".c". Since the warning is about a string literal
being converted to char* I see no reason to assume the OP was compiling
as C++, although I would say the warning is badly worded.
In this case, Eric knows the tools. Sun CC gives this warning, which is
valid for C++.

--
Ian Collins.
Sep 28 '07 #7
Flash Gordon wrote On 09/28/07 16:41,:
Eric Sosman wrote, On 28/09/07 13:10:
>>pa********@hotmail.com wrote:
>> static char* nullStr = "null";
This line in the solaris mode64 ( cc -m64 flag, gives out the
following warning message )

"virvpirw.cc", line 371: Warning: String literal converted to char* in
initialization.
1 Warning(s) detected.

Now our builds are strict and dont allow this warning too in the
building. Can we remove this by any other way.

Two-and-a-half suggestions:

1) static const char* nullStr = "null";


Yes.

> 2) Use a C compiler rather than a C++ compiler.

2a) ... or take further questions to comp.lang.c++


cc on most versions of Unix *is* a C compiler, at least when fed a file
with a name ending in ".c".
Bingo.
Since the warning is about a string literal
being converted to char* I see no reason to assume the OP was compiling
as C++, although I would say the warning is badly worded.
There are two reasons to suspect the baleful presence
of That Other Language. First, the complaint is exactly
what one would expect from T.O.L., since the type it gives
a string literal is not the same as the type used by C.
Seccond, there's a cclue that may have esccaped your
noticce when you first sccanned the diagnosticc.

--
Er*********@sun.com
Sep 28 '07 #8
In article <1g************@news.flash-gordon.me.ukFlash Gordon <sp**@flash-gordon.me.ukwrites:
....
"virvpirw.cc", line 371: Warning: String literal converted to char* in
....
cc on most versions of Unix *is* a C compiler, at least when fed a file
with a name ending in ".c".
But is that the case here?
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
Sep 29 '07 #9
Eric Sosman wrote, On 28/09/07 23:31:
Flash Gordon wrote On 09/28/07 16:41,:
>Eric Sosman wrote, On 28/09/07 13:10:
>>pa********@hotmail.com wrote:
<snip>
>>>"virvpirw.cc", line 371: Warning: String literal converted to char* in
<snip>
>Since the warning is about a string literal
being converted to char* I see no reason to assume the OP was compiling
as C++, although I would say the warning is badly worded.
<snip>
Seccond, there's a cclue that may have esccaped your
noticce when you first sccanned the diagnosticc.
Yes, I did miss that. You were correct.
--
Flash Gordon
Sep 29 '07 #10
On Sep 29, 10:31 am, Eric Sosman <Eric.Sos...@sun.comwrote:
>
>parag_p...@hotmail.com wrote:
> static char* nullStr = "null";
>>"virvpirw.cc", line 371: Warning: String literal converted to char* in
initialization.

There are two reasons to suspect the baleful presence
of That Other Language. First, the complaint is exactly
what one would expect from T.O.L., since the type it gives
a string literal is not the same as the type used by C.
The code doesn't require a diagnostic in T.O.L.
Even though string literals are const char[] in that
language, it has an implicit conversion from string
literals to char* .

Oct 1 '07 #11
Old Wolf wrote:
On Sep 29, 10:31 am, Eric Sosman <Eric.Sos...@sun.comwrote:
>>>parag_p...@hotmail.com wrote:
static char* nullStr = "null";
"virvpirw.cc", line 371: Warning: String literal converted to char* in
initialization.
There are two reasons to suspect the baleful presence
of That Other Language. First, the complaint is exactly
what one would expect from T.O.L., since the type it gives
a string literal is not the same as the type used by C.

The code doesn't require a diagnostic in T.O.L.
Even though string literals are const char[] in that
language, it has an implicit conversion from string
literals to char* .
Yet another reason to avoid T.O.L., I'd say. If you
report truly, string literals are "ignorably const char[]."
Or, "String literals are const, and I'm shocked, shocked
to learn that you might treat them otherwise." Sounds like
a language afraid to face up to its own flaws.

--
Eric Sosman
es*****@ieee-dot-org.invalid
Oct 2 '07 #12
Eric Sosman wrote:
Old Wolf wrote:
>On Sep 29, 10:31 am, Eric Sosman <Eric.Sos...@sun.comwrote:
>>>>parag_p...@hotmail.com wrote:
> static char* nullStr = "null";
>"virvpirw.cc", line 371: Warning: String literal converted to
>char* in
>initialization.
There are two reasons to suspect the baleful presence
of That Other Language. First, the complaint is exactly
what one would expect from T.O.L., since the type it gives
a string literal is not the same as the type used by C.

The code doesn't require a diagnostic in T.O.L.
Even though string literals are const char[] in that
language, it has an implicit conversion from string
literals to char* .

Yet another reason to avoid T.O.L., I'd say. If you
report truly, string literals are "ignorably const char[]."
Or, "String literals are const, and I'm shocked, shocked
to learn that you might treat them otherwise." Sounds like
a language afraid to face up to its own flaws.
Or one weighed down by the flaws of its parent :)

--
Ian Collins.
Oct 2 '07 #13

and rodney king have the same IQ."
"Ian Collins" <ia******@hotmail.comwrote in message
news:5m************@mid.individual.net...
Eric Sosman wrote:
>Old Wolf wrote:
>>On Sep 29, 10:31 am, Eric Sosman <Eric.Sos...@sun.comwrote:
>parag_p...@hotmail.com wrote:
>> static char* nullStr = "null";
>>"virvpirw.cc", line 371: Warning: String literal converted to
>>char* in
>>initialization.
There are two reasons to suspect the baleful presence
of That Other Language. First, the complaint is exactly
what one would expect from T.O.L., since the type it gives
a string literal is not the same as the type used by C.

The code doesn't require a diagnostic in T.O.L.
Even though string literals are const char[] in that
language, it has an implicit conversion from string
literals to char* .

Yet another reason to avoid T.O.L., I'd say. If you
report truly, string literals are "ignorably const char[]."
Or, "String literals are const, and I'm shocked, shocked
to learn that you might treat them otherwise." Sounds like
a language afraid to face up to its own flaws.
Or one weighed down by the flaws of its parent :)
:-)
--
wade ward
"The final irony is that cops
Oct 2 '07 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: pancho | last post by:
Greetings, I need help configuring/building PHP3 with MySQL as a DSO on a Solaris 8 box - this module is needed to host some existing sites I will be migrating Note. I built PHP4 from source and...
1
by: Mark Nelson | last post by:
Hi I'm trying to build Imaging 1.1.4 in Solaris 9, I get passwd the first step i.e the building of libImging. However when I execute a python setup.py build I get the following error - gcc...
1
by: J.D. Bronson | last post by:
I am having trouble compiling python (from src) on Solaris 10 beta and was wondering if someone can help me? ../configure (no options) all looks good then I run make: gcc -c...
0
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
4
by: Martijn de Munnik | last post by:
Hi, I want to compile python on my solaris 10 system (amd 64 bit). I did the following: ../configure --prefix=/opt/64/python make which resulted in this error:
0
by: markvr | last post by:
Not sure if this is the best place to ask this, if not please can someone point in the right direction. I am trying to compile PHP 5.2 on a Solaris 9 system. I need Oracle DB support so can't...
3
by: Lee | last post by:
Has anyone ran into this problem? I've done extensive googling and research and I cannot seem to find the answer. I downloaded the source for 2.5.1 from python.org compiled and installed it on a...
0
by: mg | last post by:
When make gets to the _ctypes section, I am getting the following in my output: building '_ctypes' extension creating build/temp.solaris-2.10-i86pc-2.5/home/ecuser/Python-2.5.1/ Modules/_ctypes...
0
by: dot.yet | last post by:
Hi Everyone, environment: DB2 9.5 WSE with FP 2a Solaris 10 u5 - 64-bit SMP - 2 Quad CPUS - total 8 cores 16 GB RAM SAMPLE database Solaris Containers
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.