[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] Overview, Sept. 2014
From: |
Steffen Nurpmeso |
Subject: |
Re: [Groff] Overview, Sept. 2014 |
Date: |
Thu, 11 Sep 2014 12:46:22 +0200 |
User-agent: |
s-nail v14.7.6-15-gc1887ab |
address@hidden wrote:
|On Wed, 10 Sep 2014, Werner LEMBERG wrote:
|>> The problem with global variables is their long range effect,
|>> comparable with the infamous goto statement: considered harmful.
|>
|> I like `goto' a lot, and it is an invaluable instruction if used with
|> care. The same is true with global variables. Sorry to say, but we
|> are now going into hearsay and hollow statements, which isn't helpful.
|
|I may have to look into this C++ stuff. I have only written C and I have
|not figured out how to write multi-threaded applications without global
|variables. And I make good use of goto and longjmp. Apps would be a lot
|junkier without them.
_I_ usually collect such global data in a structure and
instantiate that; in BSS usually, but if i there is complete
control and it is doable then on the stack and all functions take
that as a "self" first argument (most likely i use this approach
for single compilation units). This has good side-effects: i can
search for /_?g[.-] and get all global data matches (usually
without false hits, then), and i can layout the structure in a way
that minimizes useless alignment padding. I can use the global
instance as a first-time initialization switch if i base it upon
a pointer, then only have a single global mutex to protect _all_
first time inits all through the entire library / whatever. In
fact i wrote programs and libraries without any DATA section, but
text / rodata and a minimal bss, anything else was stack and
heap-bss (through the dynamic allocator a.k.a. mmap(2)).
This all was C++ (but -nostdlib -fno-rtti -fno-exceptions etc.).
--steffen
- Re: [Groff] Overview, Sept. 2014, (continued)
- Re: [Groff] Overview, Sept. 2014, Steffen Nurpmeso, 2014/09/10
- Re: [Groff] Overview, Sept. 2014, Ulrich Lauther, 2014/09/10
- Re: [Groff] Overview, Sept. 2014, Werner LEMBERG, 2014/09/10
- Re: [Groff] Overview, Sept. 2014, Ulrich Lauther, 2014/09/10
- Re: [Groff] Overview, Sept. 2014, lxnf98mm, 2014/09/10
- Re: [Groff] Overview, Sept. 2014, Werner LEMBERG, 2014/09/10
- Re: [Groff] Overview, Sept. 2014, Ulrich Lauther, 2014/09/10
- Re: [Groff] Overview, Sept. 2014, Steffen Nurpmeso, 2014/09/11
- Re: [Groff] Overview, Sept. 2014, Ralph Corderoy, 2014/09/11
- Re: [Groff] Overview, Sept. 2014, Steffen Nurpmeso, 2014/09/11
- Re: [Groff] Overview, Sept. 2014,
Steffen Nurpmeso <=
- Re: [Groff] Overview, Sept. 2014, Ralph Corderoy, 2014/09/10
- Re: [Groff] Overview, Sept. 2014, Ulrich Lauther, 2014/09/10
- Re: [Groff] Overview, Sept. 2014, Werner LEMBERG, 2014/09/10
- Re: [Groff] Overview, Sept. 2014, Ingo Schwarze, 2014/09/10
- Re: [Groff] Overview, Sept. 2014, Ulrich Lauther, 2014/09/10
- Re: [Groff] Overview, Sept. 2014, Peter Schaffter, 2014/09/10
- Re: [Groff] Overview, Sept. 2014, Steffen Nurpmeso, 2014/09/11
- Re: [Groff] Overview, Sept. 2014, James K. Lowden, 2014/09/11
- Re: [Groff] Overview, Sept. 2014, Ulrich Lauther, 2014/09/11
- Re: [Groff] Overview, Sept. 2014, Clarke Echols, 2014/09/11