473,224 Members | 1,410 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,224 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 1667
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...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.