C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compiler Compatabilities

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
Michael J. Reeves, AA, AS
Guest





PostPosted: Sat Sep 25, 2004 6:01 pm    Post subject: Compiler Compatabilities Reply with quote



I received the below response to a problem I was experiencing
using Borland C++ Builder 5.

I was wondering if this is an ongoing problem with different
publishers of alleged ISO standard compiler systems, OR is this an issue
of differences in meeting the standards???

See below for background on my question.

THANKS.

MJR
Michael J. Reeves, AA, ASc
E-Mail: [email]michaeljreeves (AT) sbcglobal (DOT) net[/email]
---------------------------------------------------------
I have no SPAM. I don't give a SPAM.
I take no SPAM from anyone. I am NOT in the SPAM business!!!
--------------------------------------------------------------------------

On 24 Sep 2004 07:31:48 -0400, [email]kanze (AT) gabi-soft (DOT) fr[/email] wrote:

Quote:
"Michael J. Reeves, AA, ASc" <michaeljreeves (AT) sbcglobal (DOT) net> wrote in
message news:<2pc1l0dr2vho6qvuuk7pi2k5p80lbibff8 (AT) 4ax (DOT) com>...
On 8 Sep 2004 17:52:02 -0400, [email]smith4894 (AT) excite (DOT) com[/email] (gorda) wrote:

Create a one dimensional array of pointers (with the length
equivilant to the number of rows you need) and make EACH pointer a
dynamically allocated one dimentional array (with the length
equivilant to the number of columns you need).

//Dynamically create a 3 by 4 array:
int rows=3, cols=4, int **x;

//create one dimensional array of pointers
x = new int*[rows];

//initialize each pointer to be another one dimentional array
for(int i = 0; i < rows; ++i)
{
x[i] = new int[cols];
}

//Can use x just like a normal array now.
x[2][2] = 4;
cout << x[2][2];

The above will not compile and run.

Where's the problem? It works with my compilers.


THAT's what I needed to know.

I am using Borland C++ Builder 5, and I find that some examples
in the texts I am using do NOT compile.

The one above submitted by a reader mimics an example from my
text, and neither will compile under this system.

I should probably start a new thread to deal with this question
of compatability among compilers.

Again, THANKS.

MJR
Michael J. Reeves, AA, ASc
E-Mail: [email]michaeljreeves (AT) sbcglobal (DOT) net[/email]
---------------------------------------------------------
I have no SPAM. I don't give a SPAM.
I take no SPAM from anyone. I am NOT in the SPAM business!!!

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
Bronek Kozicki
Guest





PostPosted: Mon Sep 27, 2004 10:29 am    Post subject: Re: Compiler Compatabilities Reply with quote



Michael J. Reeves, AA, ASc wrote:
Quote:
I received the below response to a problem I was experiencing
using Borland C++ Builder 5.

It would be far easier to give you correct response, if you supply error
message from your compiler. However, code posted below has one small
problem.

Quote:
I was wondering if this is an ongoing problem with different
publishers of alleged ISO standard compiler systems, OR is this an issue
of differences in meeting the standards???

As far as I know there are no 100% compliant compilers. Comeau
(www.comeaucomputing.com ) is closest you can get, and after it number
of recently released compilers (GCC 3.4.2, Visual C++ .NET 2003, Intel
8.0 etc.) - however none of them is fully conforming to C++ standard.
Compilers few years old (like GCC 2.95, Visual C++ 6.0 and Borland C++ )
are generally much less conforming than newer ones; some libraries (like
Boost.Spirit http://www.boost.org/libs/spirit ) won't work with such old
and non-conformiong compilers.


B.


PS. Here's error in code that you posted:
Quote:
int rows=3, cols=4, int **x;

above should read:
int rows=3, cols=4, **x;

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Retlak
Guest





PostPosted: Mon Sep 27, 2004 9:10 pm    Post subject: Re: Compiler Compatabilities Reply with quote



"Michael J. Reeves, AA, ASc" <michaeljreeves (AT) sbcglobal (DOT) net> wrote

Quote:
I received the below response to a problem I was experiencing
using Borland C++ Builder 5.
[snip]


Quote:
int rows=3, cols=4, int **x;

This isn't a question of compatibility. A compiler which accepts the
above line has a BUG. It is not valid C++. File a bug report with the
publisher of the compiler.

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Alberto Barbati
Guest





PostPosted: Mon Sep 27, 2004 9:16 pm    Post subject: Re: Compiler Compatabilities Reply with quote

Michael J. Reeves, AA, ASc wrote:
Quote:
//Dynamically create a 3 by 4 array:
int rows=3, cols=4, int **x;

This should give you a syntax error. It should be

int rows=3, cols=4; int** x;
^
semicolon here

Quote:

The above will not compile and run.

Where's the problem? It works with my compilers.


Usually it's MUCH better if you provide the exact error messages you're
getting. The sentence "will not compile" is not at all helpful...

Alberto

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.