Hi,
I have this code:
std::string::value_type * wh[] = {'\t'};
But it gives a compiler error, comlaining that it can't convert int to char.
What am I doing wrong? 6 1804
In article <rq********************************@4ax.com>,
Boogie El Aceitoso <fr****@telefonica.net> wrote: I have this code:
std::string::value_type * wh[] = {'\t'};
But it gives a compiler error, comlaining that it can't convert int to char.
What am I doing wrong?
Bad diagnostic since the error is not in converting an int to a char
but in converting a char into a valuetype *. Should it just be a
valuetype?
--
Greg Comeau/4.3.3:Full C++03 core language + more Windows backends
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
On Wed, 03 Dec 2003 16:56:20 +0100, Boogie El Aceitoso
<fr****@telefonica.net> wrote: Hi,
I have this code:
std::string::value_type * wh[] = {'\t'};
But it gives a compiler error, comlaining that it can't convert int to char.
What am I doing wrong?
Declaring an array of pointers-to-value-type. Try:
std::string::value_type wh[] = {'\t'};
Boogie El Aceitoso wrote: Hi,
I have this code:
std::string::value_type * wh[] = {'\t'};
But it gives a compiler error, comlaining that it can't convert int to char.
What am I doing wrong?
Rewrite as:
std::string::value_type * wh[] = {"\t"};
or as:
std::string::value_type wh[] = {'\t'};
- Dario
"Dario" <da***@despammed.com> wrote in message
news:bq**********@fata.cs.interbusiness.it... Boogie El Aceitoso wrote:
Hi,
I have this code:
std::string::value_type * wh[] = {'\t'};
But it gives a compiler error, comlaining that it can't convert int to
char. What am I doing wrong?
Rewrite as: std::string::value_type * wh[] = {"\t"}; or as: std::string::value_type wh[] = {'\t'};
Right, but I don't understand why OP is using string::value_type
anyway, since by definition it's 'char'.
char wh = '\t';
-Mike
In article <u8******************@newsread2.news.pas.earthlink .net>,
Mike Wahler <mk******@mkwahler.net> wrote: "Dario" <da***@despammed.com> wrote in message news:bq**********@fata.cs.interbusiness.it... Boogie El Aceitoso wrote: > std::string::value_type * wh[] = {'\t'}; > > But it gives a compiler error, comlaining that it can't convert int to > char. > > What am I doing wrong?
Rewrite as: std::string::value_type * wh[] = {"\t"}; or as: std::string::value_type wh[] = {'\t'};
Right, but I don't understand why OP is using string::value_type anyway, since by definition it's 'char'.
char wh = '\t';
Probably the OP also has wchar_t's and maybe some other,
and wants to make that connection clear.
--
Greg Comeau/4.3.3:Full C++03 core language + more Windows backends
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:u8******************@newsread2.news.pas.earth link.net... "Dario" <da***@despammed.com> wrote in message news:bq**********@fata.cs.interbusiness.it... Boogie El Aceitoso wrote:
Hi,
I have this code:
std::string::value_type * wh[] = {'\t'};
But it gives a compiler error, comlaining that it can't convert int to char. What am I doing wrong?
Rewrite as: std::string::value_type * wh[] = {"\t"}; or as: std::string::value_type wh[] = {'\t'};
Right, but I don't understand why OP is using string::value_type anyway, since by definition it's 'char'.
Probably just trying to get his head around it. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Morten Gulbrandsen |
last post by:
mysql> USE company;
Database changed
mysql>
mysql> DROP TABLE IF EXISTS EMPLOYEE;
--------------
DROP TABLE IF EXISTS EMPLOYEE
--------------
Query OK, 0 rows affected (0.00 sec)
|
by: Jacob Schmidt |
last post by:
Could anyone correct the error in my logic here?:
#include <stdio.h>
#include <stdlib.h>
main ()
{
const char message1 = {"\nCurved portion of graph -- D.G.A.C.\
\n A B C"};
const char...
|
by: GRoll35 |
last post by:
I get 4 of those errors. in the same spot. I'll show my parent class,
child class, and my driver.
All that is suppose to happen is the user enters data and it uses
parent/child class to display...
|
by: HKSHK |
last post by:
This list compares the error codes used in VB.NET 2003 with those used
in VB6.
Error Codes:
============
3: This Error number is obsolete and no longer used. (Formerly:
Return without GoSub)...
|
by: nambissan.nisha |
last post by:
I am facing this problem....
I have to define a structure at runtime as the user specifies...
The user will tell the number of fields,the actual fields...(maybe
basic or array types or...
|
by: Andrew Poelstra |
last post by:
I hammered this out this morning to fix inconsistancies with the way my
programs handle errors. The code itself is fine, in that it compiles with
Richard Heathfield's gcc tags (plus -c because it...
|
by: Gary Wessle |
last post by:
Hi
I am trying to understand how pthread is used, so I make the scenario
below, I could not understand the erros by reading the man
pthread_create.
//**************** code start...
|
by: ZMan |
last post by:
The following code won't compile with gcc version 3.4.2
(mingw-special).
How come?
Error: cannot convert `char (*)' to `char**'
/**********************************************************/...
|
by: jma |
last post by:
Hi all,
I want to push some errors on an error stack in my function. The first
parameter of the push function is the name of the function where the
error occured. For example:
int...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: 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...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
| |