473,399 Members | 2,159 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,399 software developers and data experts.

Changing case "message" to "MESSAGE"

Working my way through Koenig & Moo "Accelerated C++" and using
Borlang Builder 5 (but that is probably not relevant) I reached
exercise 1-1 and typed in

#include <vcl.h>
#pragma hdrstop
#include <iostream>
#include <string>

int main(int argc, char*argv[]}
{
const std::string hello = "Hello" // This by itself compiled
const std::string message = "Hello" // and other stuff which I have
//left out here.
system("PAUSE");
return 0;

}

But I left caps lock on, and by mistake typed MESSAGE, and it didn't
compile. I retyped message in lower case it did compile! I was
astonished. I thought you could give variables any name you liked,
capitalised or not.

What's the explanation? Is MESSAGE a reserved word?

Michael Bell

--
Nov 15 '07 #1
13 1677
On 2007-11-15 10:49:03 -0500, Michael Bell <mi*****@beaverbell.co.uksaid:
>
But I left caps lock on, and by mistake typed MESSAGE, and it didn't
compile. I retyped message in lower case it did compile! I was
astonished. I thought you could give variables any name you liked,
capitalised or not.

What's the explanation? Is MESSAGE a reserved word?
No. It's probably a macro that's defined in "vcl.h".

--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)

Nov 15 '07 #2
Michael Bell wrote:
Working my way through Koenig & Moo "Accelerated C++" and using
Borlang Builder 5 (but that is probably not relevant) I reached
exercise 1-1 and typed in

#include <vcl.h>
#pragma hdrstop
#include <iostream>
#include <string>

int main(int argc, char*argv[]}
{
const std::string hello = "Hello" // This by itself compiled
const std::string message = "Hello" // and other stuff which I have
//left out here.
system("PAUSE");
return 0;

}

But I left caps lock on, and by mistake typed MESSAGE, and it didn't
compile. I retyped message in lower case it did compile! I was
astonished. I thought you could give variables any name you liked,
capitalised or not.

What's the explanation? Is MESSAGE a reserved word?
First, I don't see any "MESSAGE" used in your text.

Second, why do you need 'argc' and 'argv' if you're not using them?

Third, I doubt Koenig's book recommends <vcl.hor hdrstop pragma,
what if you just drop those?

Forth, every declaration statement need to end with a semicolon.

Fifth, 'MESSAGE' (if you did in fact use it somewhere) _can_ be
a macro in your compiler's environment.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Nov 15 '07 #3
In message <2007111510525016807-pete@versatilecodingcom>
Pete Becker <pe**@versatilecoding.comwrote:
On 2007-11-15 10:49:03 -0500, Michael Bell <mi*****@beaverbell.co.uksaid:
>>
But I left caps lock on, and by mistake typed MESSAGE, and it didn't
compile. I retyped message in lower case it did compile! I was
astonished. I thought you could give variables any name you liked,
capitalised or not.

What's the explanation? Is MESSAGE a reserved word?
No. It's probably a macro that's defined in "vcl.h".
I was unable to test this theory because it won't complile without
#include <vcl.hat the top - the error message gives a linker error
and quotes vcl.h. And I can't trace A macro "MESSAGE" in "Borland
Builder C++ 5 for Dummies" - but that's not proof.

It doesn't matter too much. I can still get on with the book. But I
don't like it when something happens that I don't understand. But your
suggestion allows me to lay that worry aside.

Michael Bell
--
Nov 15 '07 #4
In message <fh**********@news.datemas.de>
"Victor Bazarov" <v.********@comAcast.netwrote:
Michael Bell wrote:
>Working my way through Koenig & Moo "Accelerated C++" and using
Borlang Builder 5 (but that is probably not relevant) I reached
exercise 1-1 and typed in

#include <vcl.h>
#pragma hdrstop
#include <iostream>
#include <string>

int main(int argc, char*argv[]}
{
const std::string hello = "Hello" // This by itself compiled
const std::string message = "Hello" // and other stuff which I have
//left out here.
system("PAUSE");
return 0;

}

But I left caps lock on, and by mistake typed MESSAGE, and it didn't
compile. I retyped message in lower case it did compile! I was
astonished. I thought you could give variables any name you liked,
capitalised or not.

What's the explanation? Is MESSAGE a reserved word?
First, I don't see any "MESSAGE" used in your text.
I quoted it in the correct, lower case.
Second, why do you need 'argc' and 'argv' if you're not using them?
Borland loads them by default. It runs even it I remove them. I have
no idea what they do.
Third, I doubt Koenig's book recommends <vcl.hor hdrstop pragma,
what if you just drop those?
Forth, every declaration statement need to end with a semicolon.
Yes, I missed them out. But they were there.
Fifth, 'MESSAGE' (if you did in fact use it somewhere) _can_ be
a macro in your compiler's environment.
I can't trace it in "Borland Builder C++ 5 for Dummies." But at least
I know that I haven't misunderstood the main meat of the lessons.

Michael Bell

--
Nov 15 '07 #5
Michael Bell wrote:
Working my way through Koenig & Moo "Accelerated C++"
system("PAUSE");
If that book really teaches you to do that, throw it away and buy a
better one.
Nov 15 '07 #6
Juha Nieminen wrote:
Michael Bell wrote:
>Working my way through Koenig & Moo "Accelerated C++"
>system("PAUSE");

If that book really teaches you to do that, throw it away and buy a
better one.
Nah... Just caint be. But a better compiler or IDE might actually
serve Michael well.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Nov 15 '07 #7
In message <47**********************@news.song.fi>
Juha Nieminen <no****@thanks.invalidwrote:
Michael Bell wrote:
>Working my way through Koenig & Moo "Accelerated C++"
>system("PAUSE");
If that book really teaches you to do that, throw it away and buy a
better one.
That's in "C++ for Dummies". Koenig and Moo assume that somebody who
knows what he is doing has set your computer up for you. If you run
their programs as they show on the page, the .exe opens and closes in
a tenth of a second. You've got to do something to hold it there long
enough to see it. If you think this is bad, what should I do better/

Michael Bell
--
Nov 15 '07 #8
Michael Bell wrote:
In message <47**********************@news.song.fi>
Juha Nieminen <no****@thanks.invalidwrote:
>Michael Bell wrote:
>>Working my way through Koenig & Moo "Accelerated C++"
>>system("PAUSE");
> If that book really teaches you to do that, throw it away and buy a
better one.

That's in "C++ for Dummies". Koenig and Moo assume that somebody who
knows what he is doing has set your computer up for you. If you run
their programs as they show on the page, the .exe opens and closes in
a tenth of a second. You've got to do something to hold it there long
enough to see it. If you think this is bad, what should I do better/
Use the command line version of the compiler.
Nov 15 '07 #9
On 2007-11-15 20:22, Michael Bell wrote:
In message <47**********************@news.song.fi>
Juha Nieminen <no****@thanks.invalidwrote:
>Michael Bell wrote:
>>Working my way through Koenig & Moo "Accelerated C++"
>>system("PAUSE");
> If that book really teaches you to do that, throw it away and buy a
better one.

That's in "C++ for Dummies". Koenig and Moo assume that somebody who
knows what he is doing has set your computer up for you. If you run
their programs as they show on the page, the .exe opens and closes in
a tenth of a second. You've got to do something to hold it there long
enough to see it. If you think this is bad, what should I do better/
If you use Visual C++ 2005 Express you can use Ctrl+F5 when running your
program to get a command windows that does not disappear. If you use
another IDE look into making it run a bat-file which launches the
application and then pauses instead of running the application directly.

--
Erik Wikström
Nov 15 '07 #10
"Michael Bell" <mi*****@beaverbell.co.ukwrote in message
news:6d********************@michael.beaverbell.co. uk...
In message <2007111510525016807-pete@versatilecodingcom>
Pete Becker <pe**@versatilecoding.comwrote:
>On 2007-11-15 10:49:03 -0500, Michael Bell <mi*****@beaverbell.co.uk>
said:
>>>
But I left caps lock on, and by mistake typed MESSAGE, and it didn't
compile. I retyped message in lower case it did compile! I was
astonished. I thought you could give variables any name you liked,
capitalised or not.

What's the explanation? Is MESSAGE a reserved word?
>No. It's probably a macro that's defined in "vcl.h".

I was unable to test this theory because it won't complile without
#include <vcl.hat the top - the error message gives a linker error
and quotes vcl.h. And I can't trace A macro "MESSAGE" in "Borland
Builder C++ 5 for Dummies" - but that's not proof.

It doesn't matter too much. I can still get on with the book. But I
don't like it when something happens that I don't understand. But your
suggestion allows me to lay that worry aside.
So opne up hte file vcl.h and search for MESSAGE
Nov 16 '07 #11
In message <o8**************@newsfe06.lga>
"Jim Langston" <ta*******@rocketmail.comwrote:
"Michael Bell" <mi*****@beaverbell.co.ukwrote in message
news:6d********************@michael.beaverbell.co. uk...
>In message <2007111510525016807-pete@versatilecodingcom>
Pete Becker <pe**@versatilecoding.comwrote:
>>On 2007-11-15 10:49:03 -0500, Michael Bell <mi*****@beaverbell.co.uk>
said:
>>>>
But I left caps lock on, and by mistake typed MESSAGE, and it didn't
compile. I retyped message in lower case it did compile! I was
astonished. I thought you could give variables any name you liked,
capitalised or not.

What's the explanation? Is MESSAGE a reserved word?
>>No. It's probably a macro that's defined in "vcl.h".

I was unable to test this theory because it won't complile without
#include <vcl.hat the top - the error message gives a linker error
and quotes vcl.h. And I can't trace A macro "MESSAGE" in "Borland
Builder C++ 5 for Dummies" - but that's not proof.

It doesn't matter too much. I can still get on with the book. But I
don't like it when something happens that I don't understand. But your
suggestion allows me to lay that worry aside.
So opne up hte file vcl.h and search for MESSAGE
I can't search vcl.h itself, or at least I don't know how to, but I
have searched the help for it, and there is a macro called "MESSAGE"
(UPPER CASE) so your suspicions are well founded and I know how I have
tripped over an obstacle that I had no reason to suspect was there.
All sorted then. Thank you everybody.

Michael Bell


--
Nov 16 '07 #12
On Nov 15, 8:22 pm, Michael Bell <mich...@beaverbell.co.ukwrote:
In message <473c929c$0$3198$39db0...@news.song.fi>
Juha Nieminen <nos...@thanks.invalidwrote:
Michael Bell wrote:
Working my way through Koenig & Moo "Accelerated C++"
system("PAUSE");
If that book really teaches you to do that, throw it away and buy a
better one.
That's in "C++ for Dummies". Koenig and Moo assume that
somebody who knows what he is doing has set your computer up
for you. If you run their programs as they show on the page,
the .exe opens and closes in a tenth of a second. You've got
to do something to hold it there long enough to see it. If you
think this is bad, what should I do better/
Find out how to use your IDE? Or use a different one? Erik
Wikström has posted how to use Visual Studio correctly. If
you're IDE doesn't have something similar, it's time to change
it (and Visual Studio is free, as are some others).

(Once you start programming professionally, of course, you'll
drop the IDE in favor of more powerful tools. But while
learning... having to learn all of those tools just to compile a
C++ program is perhaps biting off too much at once.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Nov 16 '07 #13
On 2007-11-16 05:18:08 -0500, Michael Bell <mi*****@beaverbell.co.uksaid:
In message <o8**************@newsfe06.lga>
"Jim Langston" <ta*******@rocketmail.comwrote:
>"Michael Bell" <mi*****@beaverbell.co.ukwrote in message
news:6d********************@michael.beaverbell.co .uk...
>>In message <2007111510525016807-pete@versatilecodingcom>
Pete Becker <pe**@versatilecoding.comwrote:

On 2007-11-15 10:49:03 -0500, Michael Bell <mi*****@beaverbell.co.uk>
said:

>
But I left caps lock on, and by mistake typed MESSAGE, and it didn't
compile. I retyped message in lower case it did compile! I was
astonished. I thought you could give variables any name you liked,
capitalised or not.
>
What's the explanation? Is MESSAGE a reserved word?
>

No. It's probably a macro that's defined in "vcl.h".

I was unable to test this theory because it won't complile without
#include <vcl.hat the top - the error message gives a linker error
and quotes vcl.h. And I can't trace A macro "MESSAGE" in "Borland
Builder C++ 5 for Dummies" - but that's not proof.

It doesn't matter too much. I can still get on with the book. But I
don't like it when something happens that I don't understand. But your
suggestion allows me to lay that worry aside.
>So opne up hte file vcl.h and search for MESSAGE

I can't search vcl.h itself, or at least I don't know how to, but I
have searched the help for it, and there is a macro called "MESSAGE"
(UPPER CASE) so your suspicions are well founded and I know how I have
tripped over an obstacle that I had no reason to suspect was there.
All sorted then. Thank you everybody.
A more general test would be to add

#undef MESSAGE

after the #include directive. But for simple programs like this one,
you don't need vcl. And your code will compile without vcl. You have to
find the compiler settings that get rid of whatever non-standard thing
is getting in the way.

--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)

Nov 16 '07 #14

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

Similar topics

1
by: Alex Li | last post by:
Dear js/xmlhttp experts, I spent hours but could not solve this problem and hope someone could give me a clue: a onclick event will invoke a function to do a few things: 1. make a hidden DIV...
1
by: JBrow | last post by:
Hi everyone, I have a form with several fields. One represents the primary key. If you leave it blank and try to save the record, the forms displays the following error message - "Index or...
2
by: Don Leverton | last post by:
Hi Folks, I'm experiencing a problem that seems to be unique to running Access97 on Windows XP, and seems to be worse on WinXP SP2. It appears when I'm trying to import a text file. I'm...
2
by: Paul Brady | last post by:
I have non-computer skilled users entering data into a form. There are certain ranges of values which, if they enter them, make no sense in the application, but I can't test them until they try to...
3
by: Rob Meade | last post by:
Hi all, Ok - probably really obvious and something I'm clearly missing...but ... I have a form with 3 areas for text to be entered, the form has some validation controls, upon it being...
1
by: Pat | last post by:
I received this message when loading a web form that was working before. I rebuilt the project, but still could not get past this error. So, I basically copied the FILENAME.aspx.vb code and...
10
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server...
7
by: PW | last post by:
Hi, I have a form with unbound fields on it. The user selects a record from a recordset and I populate the unbound fields. When I try to change the unbound quantity text box, Access 2003 tells...
3
by: =?Utf-8?B?QmFycnkgR2lsYmVydA==?= | last post by:
I would like a particular business object to ask for validation when a property is set to a specific value. In this case, I have a TimeStart property and a TimeEnd property. When creating a new...
0
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
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:
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
jinu1996
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...
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...
0
agi2029
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 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.