On Mar 31 2010, 3:16 am, Bob Kerns wrote:
> There is a much better way to do this. I have outlined it in a prior
> post, but I don't have time to dig it out or recreate it tonight.
>
> I'm planning to turn it into a blog post at some point.
>
> Basically, you do not needconditional compilation.
One other observation -- Java, having a well-defined platform-
independent output format for the compiler, makes practical another
approach -- postprocessing.
That, in fact, is what ProGuard does -- it takes the .class files, and
postprocesses them.
Likewise, the Android toolset does the same, co
I'm a bit puzzled at your response, as you seem to be addressing C/C++
rather than Java? I've probably contributed to the confusion by
talking a little bit about C++ vs C. Perhaps you intend your response
to just refer to some aspect of those remarks?
But let me try to sort it out by context.
Yo
Interesting...
Working for some years on multiplatform / multi compiler big
performance sensitive projects( console games actually), I always find
that macro / conditional compilation WAS the consensus !
Using this for distinctions between platform specifics + version
specific + switching between
A concrete example from the OP would help. I can think of cases where
conditional compilation (as done in C/C++) is and is not needed in Java.
On Apr 1, 2010 9:28 AM, "Bob Kerns" wrote:
My first response was to say "OF COURSE YOU CAN!" -- but then I
realized you must be talking about including o
My first response was to say "OF COURSE YOU CAN!" -- but then I
realized you must be talking about including or excluding data
members, rather than the actual data.
All I can say is, if you're doing that in C++, you're doing it wrong,
and you should read up on object-oriented design patterns.
C++
Hi All,
Thanks for the reply.
I will try out.
Thanks and Regards,
Dileep
On Thu, Apr 1, 2010 at 5:20 AM, Emmanuel wrote:
> Waooo...
>
> I think you are a little bit expeditive on this one !
>
> I really think #ifdef are a very important thing in C / C++, and I
> missed so much in any other
Waooo...
I think you are a little bit expeditive on this one !
I really think #ifdef are a very important thing in C / C++, and I
missed so much in any other languages I am using !
Using static / constant data can't achieve the same thing : for
instance you can't have different data in a class w
There is a much better way to do this. I have outlined it in a prior
post, but I don't have time to dig it out or recreate it tonight.
I'm planning to turn it into a blog post at some point.
Basically, you do not need conditional compilation. The *only* Java
code which needs to change is the gene
In the J2ME world of wildly non-conforming implementations,
conditional compilation is the norm. Sun even admited it by adding
"configurations" (IIRC) to NetBeans 5. EclipseMe (Now the official
Eclipse Mobile Tools for Java project--MTJ) has support for it, as
does the Antenna extension to Ant.
Th
You can download a Java decompiler and investigate yourself. I suggest
this one:
http://java.decompiler.free.fr/?q=jdgui
You'll see that it does indeed optimize when it can.
However, unlike a C file which gets linked into a .so or .dll or an
executable, Java classes may be combined in different w
It really isn't very easy to do this. In general, you can do
something like
public class MyClass
{
public static final boolean HAS_CHEEZBURGER=true;
public void someMethod()
{
if( MyClass.HAS_CHEEZBURGER)
{
doCheezburger();
} else
{
n
I suppose I should elaborate...
In C++, you should use const to declare TRUE_CONDITION to be true, and
then use regular 'if' statements. The compiler will eliminate the
clauses that can't be reached.
In Java, you can do the same thing. But since Java code generally can
run on any platform, you ge
You do not do that in Java.
I suggest you should not do that in C++, as there are better ways to
do it.
I suggest you do not use C.
On Mar 30, 2:57 am, Dilip Dilip wrote:
> Hi All,
> How to do conditional compilation in JAVA.
>
> something like in C, C++ :
>
> #ifdef TRUE_CONDITION
>
> #else
>
14 matches
Mail list logo