Monday, August 2, 2010

[android-developers] Re: Android preprocessor, //#ifdef...

First of all -- if you want to list the faults of the C language, the
preprocessor is very near the top.

That's why C++ went to great lengths to mostly remove the need for
using it, with inline functions, constants, and the like.

It's too bad they didn't remove it. It causes all kinds of difficulty
for tools. The tools for Java are generally far better than for C++ --
and the lack of a preprocessor to screw up and ambiguate the
interpretation of any piece of syntax you look at, is a huge part of
the reason.

It's also a major compilation performance hit. With a significant
amount of pain, you can get Visual Studio to avoid a lot of the
reparsing it requires, but the language basically says that to compile
any particular program file, you have to parse all the #includes,
recursively, processing the same file over and over and over again --
possibly differently each and every time, because INTEGER may mean int
in one case, unsigned int in another, and unsigned long long in yet
another.

And that's a problem for programmers, too. No, I don't mean a problem
for me, that a good C++ programmer knows how to avoid the problems. I
mean its a problem I've had to help MANY experienced C++ programmers
resolve time and time again -- often in vendor-supplied code, rather
than their own. Or when two different vendor's include files conflict
-- or one vendor's include files conflict with their own.

My long experience is that every time someone tells me they need a
preprocessor -- there turns out to be a better way. Sometimes you
replace that with code generation -- but most of the time, code
generation isn't the ultimate solution, either. Often, proper use of
introspection and metadata (the annotation facility, for example)
provide a superior (more robust, more compact, and more maintainable)
solution.

And that includes the use here -- of selecting what code to run. For
that, often the solution lies in correct modularity of the program.

Trust me -- littering your code with conditionals does not improve it.

On Jul 31, 3:09 pm, sblantipodi <perini.dav...@dpsoftware.org> wrote:
> I'm sorry for my rude and really not too much kind speaking,
> but I can't belive that android doesn't support preprocessor.
>
> I can't think on mobile programming without preprocessor, too many
> different configurations,
> think only to LVL and android market and preprocessor could be
> useful...
> Ok we can live without it, but codes becomes really unelegant...
> Sincerely I really don't like the non preprocessor way but
> unfortunantly,
> masses told that android is good and I need to develop on it :)
>
> On Jul 31, 10:58 pm, TreKing <treking...@gmail.com> wrote:
>
>
>
> > On Sat, Jul 31, 2010 at 3:00 PM, sblantipodi
> > <perini.dav...@dpsoftware.org>wrote:
>
> > > How can you develop on a mobile without preprocessing?
>
> > Quite easily, actually.
>
> > > Sure android is really good for fart app, but what else?
>
> > Is this is a serious question? Have you browsed through the Android Market
> > (as painful as that is)? There's a lot more out there than "fart apps".
>
> > > I don't want to troll but I really can't understand why I heard
> > > many developers saying "viva android" when google released the first buggy
> > > SDK.
>
> > Probably simply because it's an alternative to iPhone.
>
> > Now, someone with your experience developing for so many devices can surely
> > adapt to not having a preprocessor. It's good for many things but definitely
> > not a necessity and will certainly not cripple you when making an Android
> > App.
>
> > If you're personally that attached to having a preprocessor, no one is
> > forcing you to develop on Android.
>
> > Good luck.
>
> > --------------------------------------------------------------------------- ----------------------
> > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> > transit tracking app for Android-powered devices

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate