473,378 Members | 1,369 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,378 software developers and data experts.

Warning with the use of tolower

Greetings to everyone.

#include<iostream>

main( void )
{
unsigned char value = 'A';
std::cout << tolower(value);
return 0;
}

if I compile this using Solaris CC with +w option, then it gives me the
following warning:

Warning: Could not find source for std::tolower(int).

Please tell me why the above warning is coming and the idea to avoid
it.
Regards,
-Ajay

Jul 23 '05 #1
9 2083
You need to include <cctype> to use the single argument definition of
tolower. And don't forget to qualify it with std. Standard C++ also
disallows implicit int for function definitions:

#include<cctype>
#include<iostream>

int main( void )
{
unsigned char value = 'A';
std::cout << std::tolower(value);
return 0;
}

Jul 23 '05 #2
Hi James,

I had tried that before but it couldn't remove that warning. Moreover,
I have also tried typecasting it as int (*)(int) but that also didn't
work. I'm attaching the transcript with your suggestion as follows:

----
$/home/ajay/SUNWspro/WS6U2/bin/CC +w 1.cxx
"1.cxx", line 6: Warning: Could not find source for std::tolower(int).
----

Regards,
-Ajay

Jul 23 '05 #3
as*****@gmail.com wrote:
Greetings to everyone.

#include<iostream>

main( void )
{
unsigned char value = 'A';
std::cout << tolower(value);
return 0;
}

if I compile this using Solaris CC with +w option, then it gives me the
following warning:

Warning: Could not find source for std::tolower(int).

Please tell me why the above warning is coming and the idea to avoid
it.
Regards,
-Ajay


The C++ versions of tolower, toupper, isalnum, etc
are in <locale>. These versions work with more
charsets than just ASCII.

#include <iostream>
#include <locale>

int main()
{
unsigned char value = 'A';
char lower = std::tolower(value);
std::cout << lower << std::endl;
return 0;
}

Regards,
Larry

--
Anti-spam address, change each 'X' to '.' to reply directly.
Jul 23 '05 #4
Larry I Smith wrote:

The C++ versions of tolower, toupper, isalnum, etc
are in <locale>. These versions work with more
charsets than just ASCII.


The C versions work with more charsets than just ASCII as well. Read
about setlocale.

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)
Jul 23 '05 #5
Pete Becker wrote:
Larry I Smith wrote:

The C++ versions of tolower, toupper, isalnum, etc
are in <locale>. These versions work with more
charsets than just ASCII.


The C versions work with more charsets than just ASCII as well. Read
about setlocale.


Did I say they didn't? (:

When using C++, we use the Std C++ features wherever possible.

e.g use

#include <locale>
Jul 23 '05 #6
Larry I Smith wrote:
Pete Becker wrote:
Larry I Smith wrote:
The C++ versions of tolower, toupper, isalnum, etc
are in <locale>. These versions work with more
charsets than just ASCII.

The C versions work with more charsets than just ASCII as well. Read
about setlocale.

Did I say they didn't? (:


You obviously implied it.

When using C++, we use the Std C++ features wherever possible.


When using C++ we use the most appropriate coding technique, whether
it's labeled C, preprocessor, or whatever. Std C++ features aren't
autmoatically the best way to do something.

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)
Jul 23 '05 #7
Pete Becker wrote:
Larry I Smith wrote:
Pete Becker wrote:
Larry I Smith wrote:

The C++ versions of tolower, toupper, isalnum, etc
are in <locale>. These versions work with more
charsets than just ASCII.
The C versions work with more charsets than just ASCII as well. Read
about setlocale.
Did I say they didn't? (:


You obviously implied it.


I sure didn't mean to...

When using C++, we use the Std C++ features wherever possible.


When using C++ we use the most appropriate coding technique, whether
it's labeled C, preprocessor, or whatever. Std C++ features aren't
autmoatically the best way to do something.


Well, OK. To each his own. (:

Larry

--
Anti-spam address, change each 'X' to '.' to reply directly.
Jul 23 '05 #8
Larry I Smith wrote:
Pete Becker wrote:
Larry I Smith wrote:

When using C++, we use the Std C++ features wherever possible.


When using C++ we use the most appropriate coding technique, whether
it's labeled C, preprocessor, or whatever. Std C++ features aren't
autmoatically the best way to do something.

Well, OK. To each his own. (:


Being supercilious is not the same as being right.

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)
Jul 23 '05 #9
Pete Becker wrote:
Larry I Smith wrote:
Pete Becker wrote:
Larry I Smith wrote:

When using C++, we use the Std C++ features wherever possible.
When using C++ we use the most appropriate coding technique, whether
it's labeled C, preprocessor, or whatever. Std C++ features aren't
autmoatically the best way to do something.

Well, OK. To each his own. (:


Being supercilious is not the same as being right.


It's not a matter of "being right", or wrong. It's
just a matter of choice. Both versions of tolower()
work just fine.

We use the Std C++ features primarily. That's just
the choice made by our corporate Engineering Council
and defined in our Coding Standards.

I really didn't mean to upset anyone over the simple
choice of using std::tolower() versus ::tolower().

Regards,
Larry

--
Anti-spam address, change each 'X' to '.' to reply directly.
Jul 23 '05 #10

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

Similar topics

3
by: qazmlp | last post by:
I was using the following code to convert the string to lowercase. string foo = "Some Mixed Case Text"; transform(foo.begin(), foo.end(), foo.begin(), tolower); I thought the above code is...
13
by: David Rubin | last post by:
I get an error when I compile the following code: #include <algorithm> #include <cctype> #include <iostream> #include <string> using namespace std; string&
11
by: TheDD | last post by:
Hello, i don't manage to use the tolower() function: #include <algorithm> #include <iostream> #include <locale> #include <string> using std::cout;
4
by: Sean Bartholomew | last post by:
even though my code works and everything i keep getting these annoying messages. can anyone help? Path for the user defined root 'CT_INSTALL' cannot be found '' Warning : illegal multi-line...
2
by: Daniel Aarno | last post by:
As far as I can tell the locale header should provide a tolower function however the following failes for me under gcc 3.4. transform(begin, end, begin2, std::tolower); with an error that the...
4
by: Eric Lilja | last post by:
Hello, consider this program: #include <iostream> #include <algorithm> #include <string> #include <cctype> int main() { std::string s = "HEJ";
6
by: Tom McL. | last post by:
I'm trying to move a program that was designed using Visual Studio 2003 and (Visual Basic) into Visual Studio 2005. When it runs I get the following warning in the Error List Window and I'm not...
13
by: Soumen | last post by:
I wanted convert a mixed case string to a lower case one. And I tried following code: std::transform(mixedCaseString.begin(), mixedCaseString::end(), mixedCaseString.begin(),...
1
by: anithaapr05 | last post by:
After the session end i try to write the session value.In this, it write the session value after the session end, but i got the warning in application event. My asp code: void...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
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...

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.