Advertisement

"Conditional" compilation.

Started by June 05, 2000 01:17 PM
11 comments, last by MadKeithV 24 years, 6 months ago
I suggest you check out the free commandlinetools from Borland. It includes a pretty decent C++ compiler, which adheres quite nicely to the standard. It includes a good STL implementation as well. Downsides: it doesn''t come with an IDE and a debugger.

See http://www.borland.com/bcppbuilder/freecompiler/ for downloads and info.

Erik
*grin* Erik - the install program just finished as I read your message.

I''m going to see how Borland copes with my weird template constructions now.

#pragma DWIM // Do What I Mean!
~ Mad Keith ~
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.
Advertisement
Okay, BCC32 compiles it, no warnings, no errors, and calls the correct functions.

GREAT!

Borland/Inprise just acquired a bit of respect from me, very nice.

This is the template class and main that will not compile under VC6.0 while being correct ANSI C++.

typedef float vector_3f[3];typedef float vector_2f[2];#include template< class vector_type > void Add_vector ( const vector_type &v1, const vector_type &v2, vector_type &v_out ) {  cout << "general add \n";  for( int x = 0; x < 2; x++ )    v_out[x] = v1[x] + v2[x];}inline void Add_vector( const vector_3f &v1, const vector_3f &v2, vector_3f &v_out ){  cout << "3f add \n";  v_out[0] = v1[0] + v2[0];  v_out[1] = v1[1] + v2[1];  v_out[2] = v1[2] + v2[2];}void main( void ){  vector_3f vec_3_a, vec_3_b, vec_3_c;  vector_2f vec_2_a, vec_2_b, vec_2_c;  Add_vector( vec_2_a, vec_2_b, vec_2_c );  Add_vector( vec_3_a, vec_3_b, vec_3_c );}Output:General add3f add  


Victory!


#pragma DWIM // Do What I Mean!
~ Mad Keith ~

Edited by - MadKeithV on June 6, 2000 7:15:31 AM
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.

This topic is closed to new replies.

Advertisement