Go Back   ZeroC Forums > Comments

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 09-12-2003
yonik yonik is offline
Registered User
 
 
Join Date: Sep 2003
Location: NJ
Posts: 9
ICE preprocessor

"""
The only purpose for which #ifndef, #define, and #endif directives can be used is to create a double-include block.
"""

This seems rather odd... if that is truly the only purpose, can't that be a rule the compiler must implement - no files will be processed more than once?

Is your statement also meant to preclude the inclusion/exclusion of code by setting a macro outside the file like so:

compiler -DDEBUG source_file.ice

------------------ source_file.ice ----------------

interface myInterface {
void foo();
#ifdef DEBUG
void printInternalState();
#endif
};

Oh, and for goodness sakes, can't we make the semicolon at the end of a type definition optional (or kill it altogether)? Forgetting it will be a very common mistake.
It was easy enough to remember when all you programed in was C++, but now with Java, C#, etc, it becomes half impossible to remember it!

-Yonik
Reply With Quote
  #2 (permalink)  
Old 09-12-2003
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
The reason why we limited the use of the C preprocessor is to make it possible to replace it someday with something else, such as "import" statements.

However, it seems more and more unlikely that we will ever do this. So far the C preprocessor worked rather well, so there is no real reason to remove it. Without the C preprocessor it would also be difficult to automatically generate dependencies of Slice files.
Reply With Quote
  #3 (permalink)  
Old 09-12-2003
yonik yonik is offline
Registered User
 
 
Join Date: Sep 2003
Location: NJ
Posts: 9
My question was more about why can't the slice compiler prevent multiple inclusion on it's own. It's certainly cleaner.

It looks more like you included #define directives simply to prevent multiple inclusion. And you need to prevent multiple inclusion that way because you are using the C preprocessor in your implementation. That's not a great reason IMHO.
Reply With Quote
  #4 (permalink)  
Old 09-18-2003
michi's Avatar
michi michi is offline
ZeroC Staff
 
Name: Michi Henning
Organization: ZeroC
Project: Ice
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 909
Quote:
Originally posted by yonik
My question was more about why can't the slice compiler prevent multiple inclusion on it's own. It's certainly cleaner.

It looks more like you included #define directives simply to prevent multiple inclusion. And you need to prevent multiple inclusion that way because you are using the C preprocessor in your implementation. That's not a great reason IMHO.
Hmmm... Yes, I get your drift. Basically, we used the preprocessor as a matter of convenience more than anything else. And, given that the preprocessor is used, we of course ended up using the standard mechanism to prevent double inclusion.

I think it might be possible to modify the Slice parser to automatically skip over files that are included more than once. I'll have a look at this when I get back to Australia in early October.

Cheers,

Michi.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 08:56 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.