[cairo] Cairo tutorial
Kalle Vahlman
kalle.vahlman at gmail.com
Sun Jul 8 01:25:56 PDT 2007
2007/7/8, Craig Ringer <craig at postnewspapers.com.au>:
> Kalle Vahlman wrote:
> > 2007/7/7, Nis Martensen <nis.martensen at web.de>:
> >> There are two problems:
> >>
> >> 1. I cannot get any text-related code to work. My test program
> >> (based on the C example in the FAQ) is this:
> > [snip]
> >> 13 cairo_text_extents_t *te;
> >
> > 1. You don't declare variables in the middle of functions in C, that's
> > a C++ thing.
>
> It's perfectly fine if you're going to be relying on a modern compiler
> that's been updated for c99.
Ah yes, I should've stated that as "Traditionally, you don't... in C
(though it works, but not everywhere)...". In general I'd avoid
anything not guaranteed to be a common practice in tutorials.
> Personally I find declaring variables on first use much more readable
> and maintainable, but it's not actually important like it is in C++
> (where initializing a variable can be _expensive_).
I would like to use in-the-middle declarations for temporary variables
and such, but don't really know if non-c99 compilers are insignificant
enough to be overlooked...
--
Kalle Vahlman, zuh at iki.fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi
More information about the cairo
mailing list