[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: File Global Variables in oct Files
From: |
Jordi Gutiérrez Hermoso |
Subject: |
Re: File Global Variables in oct Files |
Date: |
Tue, 12 Mar 2013 14:55:16 -0400 |
On 12 March 2013 14:20, Thomas D. Dean <address@hidden> wrote:
> Most of the functions in these files reference variables declared in one
> file.
>
> file1.cc
> int xxx;
> void file1(...)
> xxx = 3;
> file2(...);
> ...
> )
>
> file2.cc
> extern int xxx
> void file2(..._
> if (xxx == 3) xxx++;
> ...
> }
>
> etc.
>
> Is this a problem in oct files?
It's a problem in C++ in general:
http://www.parashift.com/c++-faq/static-init-order.html
If you understand this in general and how to fix it, it's ok to write
oct files this way.
- Jordi G. H.