[Freeciv-Dev] Re: Profiling Civserver again
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Double underbar as in "__blort" is reserved to the OS headers which you can
verify by looking in /usr/include.
No user code is supposed to use single underbars "_FOOlish" for variable
names, so they are "safe" in user header macros.
Be careful of overlapping macro arguments, i.e. passing an _x0 arg into
another
macro, but usually you can even get away with namespace collisions between
macros. However, users that peek and use the _variables within the begin
and end blocks of the current split macro flavour do so at their own risk,
i.e. should be careful to check that there isn't an overriding local
context due to nesting.
Some of the current map.h macros actually have code in the end blocks, i.e.
the user or another macro could unintentionally modify things in dangerous
ways. It is slightly safer to try to put all the internal stuff in a single
block at the start where no one can get at it at least for one iteration
block sequence, and on a new iteration there is usually only a subset of
local variables that are dangerous.
The mapgen.c examples from a couple emails ago tried to follow these
published and unpublished standards.
Cheers,
RossW
=====
At 11:03 PM 01/07/29 +0200, Thue Janus Kristensen wrote:
>You should name the internal macro variable "border" something to be sure
there are
>no name clashes. ie
>
>{
> int border = 0;
>
> adjc_dir_iterate {
> if (A=B)
> border++;
> } adjc_dir_iterate_end;
>
> printf("%d\n", border);
>}
>
>Would give the poor user quite a headache.
>
>I like the idea of prefixing with "_", as seen in Ross W. Wetmore's patches.
>
>(note that you don't have to do this with the arguments.)
>
>-Thue
- [Freeciv-Dev] Re: Profiling Civserver again, (continued)
- [Freeciv-Dev] Re: Profiling Civserver again, Reinier Post, 2001/07/30
- [Freeciv-Dev] Re: Profiling Civserver again, Trent Piepho, 2001/07/26
- [Freeciv-Dev] Re: Profiling Civserver again, Trent Piepho, 2001/07/26
- [Freeciv-Dev] map wrapping (was: Profiling Civserver again), Mike Kaufman, 2001/07/26
- [Freeciv-Dev] Re: Profiling Civserver again, Jason Dorje Short, 2001/07/26
- [Freeciv-Dev] Re: Profiling Civserver again, Ross W. Wetmore, 2001/07/26
- [Freeciv-Dev] Re: Profiling Civserver again, Gaute B Strokkenes, 2001/07/29
- [Freeciv-Dev] Re: Profiling Civserver agai, Vasco Alexandre Da Silva Costa, 2001/07/29
- [Freeciv-Dev] Re: Profiling Civserver again, Thue Janus Kristensen, 2001/07/29
- [Freeciv-Dev] Re: Profiling Civserver again, Gaute B Strokkenes, 2001/07/29
- [Freeciv-Dev] Re: Profiling Civserver again,
Ross W. Wetmore <=
- [Freeciv-Dev] Re: Profiling Civserver again, Ross W. Wetmore, 2001/07/29
- [Freeciv-Dev] Re: Profiling Civserver again, Jason Dorje Short, 2001/07/30
- [Freeciv-Dev] Re: Profiling Civserver again, Trent Piepho, 2001/07/30
- Message not available
- [Freeciv-Dev] Re: Profiling Civserver again, Ross W. Wetmore, 2001/07/30
- Message not available
- Message not available
- Message not available
- Message not available
- [Freeciv-Dev] Re: Profiling Civserver again, Paul Zastoupil, 2001/07/31
- [Freeciv-Dev] Re: Profiling Civserver again, Jason Dorje Short, 2001/07/31
- [Freeciv-Dev] Re: Profiling Civserver again, Thue, 2001/07/31
- [Freeciv-Dev] Re: Profiling Civserver again, Ross W. Wetmore, 2001/07/31
- [Freeciv-Dev] Re: Profiling Civserver again, Gregory Berkolaiko, 2001/07/31
- [Freeciv-Dev] Re: Profiling Civserver again, Gregory Berkolaiko, 2001/07/29
|
|