Warning to newbies

S

spinoza1111

OK. Let's start with some original Limericks, written this evening by
me for you, dear heart.

There is a "Colonel" named Sanders
Who said, das ist eine Anders
He's so unlike a normal jerk
That to bring him down shall be my work
So Sprache that phony Colonel named Sanders.

There is a rube named Harlan
Who said to his ex-wife, Darlin',
The child support check is gonna be late
I lost my job haulin' freight,
That clueless rube named Harlan.

There is a guy, whose rank is Colonel
On his head he wears a funnel:
He is prone to delusions
Fits, starts, brown studies and confusions,
That pathetic fool whose rank is Colonel.

Perhaps you'd like a Clerihew?

Harlan Sanders
Don't like grandstanders,
Trolls and people who are
Smarter than he, by far.

Hows about some heroic couplets?

And Lo, a missive from the Colonel of some Regiment
Full of what he supposes is fine and normal Sentiment,
Cautionubf all who listen to take condign Heed
Not to listen to Spinoza, he says there is no Need.
This is a man who prizes Silence, and thinks the silent to be strong
Words irritate him and any Text that is to him overlong.
He won't be taxed, by Cracky, by gosh, Tarnation and by Gum
He'll muster up a Jacquerie and from the woodshed, he'll get his gun
A Blunder Buss or Brownish Bess from the French and Indian wars
Which he spent drilling on the Commons to the taunts and hoots of
Whores.
He'll march his Troop of addled Lads to the Castle of ill Fame
He'll have it out for once and all, to Spinoza he'll bring shame!
But when he mocks and when he rants 'tis to him that Fortune is most
cruel:
For his repeated postings are clearly the Phillipics of the Phool!
 
S

spinoza1111

spinoza1111wrote:
If you are under the impression that you are posting interesting and
creative material about C, you are mistaken. If you don't enjoy abusing
people, you can simply stop doing it.

You're the abuser, Richard. You talk about people as if they were
objects, speaking insultingly of them to third parties and
consistently enabling people like "Colonel Harlan Sanders" who,
without any interest in the topic of the newsgroup, take your cue to
start in on people, even as Adolf Hitler (yeah baby) used Rohm and the
Sturmbateilung Arbeiter to kick the shit out of people in the back of
the beer hall while he talked of Kultur out front.

You also seek to censor interesting discussions when you cannot
dominate them with what little you've learned working as a short-term
contract programmer by means of Topic Fascism, uttering absurdities
such as "comp.programming is not about programmers". You seek to
exercise thought-control on others by deliberately their professional
credibility in a public medium where potential employers may make
judgements on people based on your lies.

WE FIGHT BACK.

And you can't stand it.
 
S

spinoza1111

Chris M. Thomasson said:
[...]

This logic will most definitely work, but unfortunately a high amount of
"pressure" will be bearing down on the memory allocator and garbage
collector if I frequently execute it. This is why I was so disappointed to
find out that Sun implemented `AtomicStampedReference' this way.
I cannot think of any other technique to implement DWCAS in 100% pure C#
without resorting to COW. I thought of a possible optimization which
involved reusing allocated data-structures, but sadly this won't work due
to a fairly nasty race-condition called the ABA problem:

WOW! I must be a STUPID ASS RETARD or something!!

A fairly nice portable solution was staring me right in the damn face
Spinoza. I can simply implement one of my new inventions, a wait-free
word-based proxy garbage collector algorithm, in C#:

http://groups.google.com/group/comp.programming.threads/browse_frm/th...

This would completely solve ABA, and take a shi%load of pressure off the C#
garbage collector. This would even be useful in Java and it would
definitely, beyond a reasonable doubt, beat the living crap out of a
solution based on Sun's implementation of the `AtomicStampedReference'. The
solution would be in 100% pure C#, and therefore retain all of the benefits
of managed code. The funny/odd thing is that I am using a "garbage
collector" to help out a garbage collector; very interesting...

Now, I still will not be able to "instantly" reuse objects, however, the
fact that I can take a lot of pressure off the GC is very attractive.

Great! But again, your work is in part over my head. I am glad to have
assisted you even if I have done so inadvertently as it were it a fit
of absent mindedness.
;^)

[...]
 
S

spinoza1111

No. Again, you need to read "Fly by Wire: The Geese, the Glide and the
Miracle on the Hudson" by William Langewiesche.

No, I don't need to read that, oh clueless one.

[snip most, no all, of Baldrick's irrelevant burblings]

The Break Room Kiddies strike again even as the light of truth breaks
slowly in here with great posts by Thomasson and James. The
Troglodytes babble in the darkness. Their Dark Lord, Heathfield,
screeches curses.

No, I guess you don't need to read jack fucking shit, pal, you have
all the clues you need, such as a detailed knowledge of TV.
 
S

spinoza1111

[...]
The problem being that the software in these planes (and in
automobiles such as the Toyota) can't be written in a language like C
which does allow the programmer to code outside of sensible boundaries
for shits, giggles and "efficiency". Programmers need to be LESS
skilled and consider themselves clerks, and they need, in my view, to
be forced, especially in mission-critical systems, to be glorified
clerks, by requiring that they code in Java or C#, not C.

What about C++ Edward?

http://www2.research.att.com/~bs/JSF-AV-rules.pdf

IMO, this is definitely an area that simply cannot tolerate any type of bug
whatsoever. I can see it know:

I'd say military avionics is more bug-tolerant than civilian, wouldn't
you? Don't get me started on jet fighters...and how in the absence of
the conflict for which they were designed (an all-out conventional war
between the USSR and USA) they are used on populations of the Third
World that consist mostly of children owing to simple demographics.
For example, Israel used fighters EXCLUSIVELY for attacks on civilians
during last year's three week war on Gaza.

My civilian understanding is that the pilot of a jet fighter can in
most extreme situations bail out explosively and float gently to earth
in a parachute. His ass might hurt for a couple of days.

But they don't give parachutes to passengers of civilian jets.

I conclude that the safety requirements for civilian aviation are
higher. Unfortunately, Langewiesche doesn't specify what programming
language was used for the A320's fly by wire software. I really,
really hope it's something like Ada or Eiffel and not C++.
 
S

spinoza1111

OK. Let's start with some original Limericks, written this evening by
me for you, dear heart.

There is a "Colonel" named Sanders
Who said, das ist eine Anders
He's so unlike a normal jerk
That to bring him down shall be my work
So Sprache that phony Colonel named Sanders.

There is a rube named Harlan
Who said to his ex-wife, Darlin',
The child support check is gonna be late
I lost my job haulin' freight,
That clueless rube named Harlan.

There is a guy, whose rank is Colonel
On his head he wears a funnel:
He is prone to delusions
Fits, starts, brown studies and confusions,
That pathetic fool whose rank is Colonel.

Perhaps you'd like a Clerihew?

Harlan Sanders
Don't like grandstanders,
Trolls and people who are
Smarter than he, by far.

Hows about some heroic couplets?

And Lo, a missive from the Colonel of some Regiment
Full of what he supposes is fine and normal Sentiment,
Cautionubf all who listen to take condign Heed
Not to listen to Spinoza, he says there is no Need.
This is a man who prizes Silence, and thinks the silent to be strong
Words irritate him and any Text that is to him overlong.
He won't be taxed, by Cracky, by gosh, Tarnation and by Gum
He'll muster up a Jacquerie and from the woodshed, he'll get his gun
A Blunder Buss or Brownish Bess from the French and Indian wars
Which he spent drilling on the Commons to the taunts and hoots of
Whores.
He'll march his Troop of addled Lads to the Castle of ill Fame
He'll have it out for once and all, to Spinoza he'll bring shame!
But when he mocks and when he rants 'tis to him that Fortune is most
cruel:
For his repeated postings are clearly the Phillipics of the Phool!

That should be:

And Lo, a missive from the Colonel of some Regiment
Full of what he supposes is fine and normal Sentiment,
Cautioning all who listen to take condign Heed
[Corrected]
Not to listen to Spinoza, he says there is no Need.
This is a man who prizes Silence, and thinks the silent to be strong
Words irritate him and any Text that is to him overlong.
He won't be taxed, by Cracky, by gosh, Tarnation and by Gum
He'll muster up a Jacquerie and from the woodshed, he'll get his gun
A Blunder Buss or Brownish Bess from the French and Indian wars
Which he spent drilling on the Commons to the taunts and hoots of
Whores.
He'll march his Troop of addled Lads to the Castle of ill Fame
He'll have it out for once and all, to Spinoza he'll bring shame!
But when he mocks and when he rants 'tis to him that Fortune is most
cruel:
For his repeated postings are clearly the Phillipics of the Phool!
 
C

Colonel Harlan Sanders

What's disgusting is what happens to people who take the risk of
posting interesting and creative material about C and related matters,
only to find themselves the target of abuse.

True, you certainly have targetted Seebs and Heathfield for abuse.
This character Harlan, in particular, has contributed nothing to this
discussion except abuse in which he takes his cue from the mob.

Mob? I thought I was a transvestite loner in a basement -- when did I
become part of a mob?
He seeks to expose others and to ascribe to them the weakness,
impotence and fear he feels in a ridiculous zero-sum exchange in
which that gives him masturbatory relief.

Was that more of your versification? I see a William S Burroughs
influence. Random phrases tacked together that make no sense, yet
manage to give an impression of malice.

Anyway, have you reported to Schildt on the progress of your campaign
to improve his image in c.l.c? He must be happy with your achievements
here. Fire up that ouija board you use to talk to him and give him an
update.
 
S

spinoza1111

spinoza1111wrote:



Ah, some sense. For once, I can agree with you. It's silly. I see no
point in enforcing a return statement in a function with void return
type, but in functions that are declared as returning a value, surely it
isn't asking too much of the programmer to require a value to be
returned (that is, for the lack of a return statement to be a constraint
violation).

So, you admit that the compiler can detect it. Good. Now the compiler
can fix it by generating an extra machine instruction to return a
zero.

However, having started at Bell-Northern Research in Dec 1981 by being
asked to modify their internal compiler, I am aware that this is a
risk. Ottawa in a cost-saving and Wall Street pleasing fit had
disbanded the compiler group in Canada, and it took several months for
budget to be approved to make a simple change.

If the C standards group had legislated that "henceforth, missing
return shall be the return of zero", vendors would have had a fit,
because in many cases they'd have disbanded the original C compiler
group. The bean counters controlled the standards writers and the
result is a useless POS of a standard. IMO.

It's not a question of being "good enough" to remember to return
something, any more than airline passengers don't want to have to
worry that their pilot has the ability of Chesley Sullenberger, who
landed the Airbus in the Hudson. The fact is, in aviation, China
Airlines is advertising for pilot TRAINEES without requiring either
college or flight school in the South China Morning Post because its
new Airbuses don't require ace pilots anymore, and for the same
reason, many programmers in the USA don't program any more: they
attend meetings.

If the vendors actively prevented the C standards people from creating
a safer C, then the vendors will be at fault if C is used in a mission-
critical environment, since the executives of the company writing the
mission-critical software may very well have been reassured that the C
used was "standard", and they will believe that this means it's "safe
to use".

But as you yourself have shown us, a C program can be "standard" and
full of bugs. The Standards don't mandate error reports in many
undefined situations: they simply say "gee, that's undefined, pal,
isn't that a shame", in essence.

This is normalized deviance.
 
S

spinoza1111

True, you certainly have targetted Seebs and Heathfield for abuse.


Mob? I thought I was a transvestite loner in a basement -- when did I
become part of a mob?

Yes, a cross-dressed loner in a basement,
In bra, panties, and a Hitler Hat,
Joining an ONLINE mob. Get it, slob?
Was that more of your versification? I see a William S Burroughs
influence. Random phrases tacked together that make no sense, yet
manage to give an impression of malice.

It makes no sense, Hortense, if you cannot read
You should learn Ignorance, to plead
And if your horizons extend no further back
Than Burroughs, wack,
Then metrical verse in the style of Dryden or Pope?
Forget it, to ken it, it is beyond that for which thou may hope.
 
C

Chris M. Thomasson

[...]
The problem being that the software in these planes (and in
automobiles such as the Toyota) can't be written in a language like C
which does allow the programmer to code outside of sensible boundaries
for shits, giggles and "efficiency". Programmers need to be LESS
skilled and consider themselves clerks, and they need, in my view, to
be forced, especially in mission-critical systems, to be glorified
clerks, by requiring that they code in Java or C#, not C.

What about C++ Edward?

http://www2.research.att.com/~bs/JSF-AV-rules.pdf

IMO, this is definitely an area that simply cannot tolerate any type of
bug
whatsoever. I can see it know:
I'd say military avionics is more bug-tolerant than civilian, wouldn't
you? Don't get me started on jet fighters...and how in the absence of
the conflict for which they were designed (an all-out conventional war
between the USSR and USA) they are used on populations of the Third
World that consist mostly of children owing to simple demographics.
For example, Israel used fighters EXCLUSIVELY for attacks on civilians
during last year's three week war on Gaza.
My civilian understanding is that the pilot of a jet fighter can in
most extreme situations bail out explosively and float gently to earth
in a parachute. His ass might hurt for a couple of days.
But they don't give parachutes to passengers of civilian jets.


Touché!


That is simply an excellent point Spinoza. However, with my luck I would
probably be able to watch the damn jet crash right into a suburban area
resulting in the slaughter of a dozen or so innocent people! What a fuc%ing
nightmare.


;^(...


So, even though jet fighters are more tolerant to bugs, it's still probably
better to go ahead and use a safer language anyway...



I conclude that the safety requirements for civilian aviation are
higher. Unfortunately, Langewiesche doesn't specify what programming
language was used for the A320's fly by wire software. I really,
really hope it's something like Ada or Eiffel and not C++.

I have to agree with you on this.


Thank you.
 
C

Chris M. Thomasson

The problem was one of computer science, but Kiki, filled with
resentment if not hate, kept whining that it was off topic because C
Sharp could handle the problem with ease.

Yes, C# can indeed handle the problem. However, it's not exactly all
that
"efficient" because it needs to do a full blown copy-on-write and use
garbage collection to ensure that everything works as expected. In other
words, I cannot operate on data-structures directly like I can using
assembly language. FWIW, this is exactly how Sun implemented
`AtomicStampedReference'.[...]
Can't you just let Moore's Law handle "efficiency"?

That's a fair point Edward, however I am highly interested in exploring
techniques that allow software to have excellent scalability, throughput and
performance characteristics on multi-processor systems. If the algorithm
does not scale well, then it's basically dead in the water wrt upcoming
many-core systems.


IMHO, it's not really enough anymore to simply think in terms of `faster
clock rate's = faster software'. Instead, you need to think about how your
software can possibly scale up and adapt to a new system that might have 5
to 10 times the number of processors that you are normally accustomed to
working with. For instance, imagine a software product that runs great on a
4-core system. Then one it's users purchases a 64-core system and installs
said software and does not see any speedup whatsoever. Well, the call to
customer service might go something like:


"I just purchased one of those new multi-core systems, and your application
suite seems to execute critical tasks a little bit slower than usual! Why is
that? Do I have to set some special configuration options? Please help..."


That's right, a poorly written multi-threaded application could actually
perform worse in a multi-core environment. I believe a company would have an
advertising and promotion advantage if it were able to say:


"Our company has recently accomplished the steps that are necessary in order
to create high-end software that is able to efficiently address the
concurrency revolution that is currently underway in the programming
community."


IMHO, software developers should try and learn how to properly address the
"Rise of the Multi-Core Machines!" in order to create quality highly
scaleable products that the consumers deserve. FWIW, here is an article by
Herb Sutter that just might be of interest to you:

http://www.gotw.ca/publications/concurrency-ddj.htm



Sure, not everything can be interpreted since this would multiply all
times by a constant or even a variable number of times because when
things are interpreted, something happens for each instruction. But as
I have shown, C sharp is compiled at the last minute and not
interpreted.
In my view, garbage collection is such a great thing that we shouldn't
be sad that it happens.

I think that garbage collection is an extraordinary convenient tool indeed
and, IMVHO, it's definitely worthwhile to try and reduce the
"burden/pressure" on it in order to help make it's job "easier". So, I think
that some forms of manual memory management can indeed be beneficial in a
fully garbage collected environment. For instance, something as simple as an
object cache can potentially help out things out:


Imagine a simple container in which you push/pop references to objects. Now,
on every push operation you allocate an internal node to hold the reference
and insert it into the collection. On every pop you remove a node a return
the reference. No need to explicitly free any internal nodes because the GC
just handles all if it for you; very nice! However, this can begin to build
up nodes that "do not necessarily have to exist". Think of pushing and
popping 10,000 nodes. Now, those 10,000 nodes might still exist even though
the collection is completely empty. Then you push and pop 10,000 more. Now
there might be 20,000 nodes floating around waiting for the GC to kick in
and clean everything. This is due to the non-deterministic nature of a
general purpose GC.

Okay, so what would happen if you used a simple node cache? The push
operation would check the cache and only allocate new nodes if it was empty.
The pop operation just sticks popped nodes into said cache if the number of
nodes it currently contains is below a certain threshold, say 50,000 nodes.
In this scenario, when you push/pop 10,000 nodes and then push/pop 10,000
more you are guaranteed to only have 10,000 nodes in existence. Therefore, I
kind of think that the GC would be fairly happy that you actually took the
time to take some of the pressure off of it. Yes, this is definitely a form
of manual memory management which is more complicated and error prone, but
it does have it's perks... ;^)


Is that making any sense Edward?



However, I have NEVER programmed OSen or embedded systems for real
money, although I've written a number of compilers. I understand that
absolute performance goals may apply. I do object to treating
performance speed as an unalloyed good when the customer doesn't ask
for it.

I think that one class of software than can benefit from heavy optimizations
could be database servers. If a company upgrades their server farms with
higher end systems that have many more cores inside of them and your
database software does not scale up, well, then they are probably going to
be extremely pissed of. I would not want to receive that phone call; yikes!

:^o
 
C

Chris M. Thomasson

Great! But again, your work is in part over my head. I am glad to have
assisted you even if I have done so inadvertently as it were it a fit
of absent mindedness.

I thank you for your valuable time and assistance Spinoza, I really do
appreciate it.

:^)
 
R

Richard Tobin

spinoza1111 said:
Now the compiler
can fix it by generating an extra machine instruction to return a
zero.

I don't see that as fixing it. It should be an error.

Zero is a fairly common return value for integer functions, so it
might be a reasonable default. But why have a default at all? Is the
gain in this case worth missing a fairly common programmer mistake?

And what if the function doesn't return an integer? In particular,
what will you do if it returns a structure?

-- Richard
 
S

Seebs

ok you got me.

"Poe's Law".

http://rationalwiki.com/wiki/Poe's_Law

"Without a winking smiley or other blatant display of humor, it is
impossible to create a parody of Fundamentalism that SOMEONE won't
mistake for the real thing."

There was a debate on a religious BBS, in which a user who went by the
name "Nathan Poe" coined the term and the law. It's a sufficiently useful
law to be of general utility in dealing with trolls. You simply can't
tell from the available data whether Nilges actually believes a lot of
this stuff. He's sufficiently self-contradictory to make it hard to tell.

-s
 
R

robertwessel2

spinoza1111 wrote:



Ah, some sense. For once, I can agree with you. It's silly. I see no
point in enforcing a return statement in a function with void return
type, but in functions that are declared as returning a value, surely it
isn't asking too much of the programmer to require a value to be
returned (that is, for the lack of a return statement to be a constraint
violation).


An interesting problem is for functions that are coded in such a way
as to make reaching the end of the function impossible. That may
happen in the case of a loop which will be exited from via a return
inside the loop, or be calling some functions (abort(), for example),
that will not return.

Neither case is easy (or in fact necessarily possible at all, since
they break down to the halting problem in the general case) for a
compiler to detect. That leaves the somewhat unpleasant requirement
of putting a dummy return statement at the end of such a function to
suppress the diagnostic (and many compilers do, of course, warn about
that). Probably a better approach would be a constraint specification
("__should_never_get_here__") that could be inserted by the programmer
that the compiler can understand, and toss some kind of exception if
it does happen.
 
S

Seebs

Ah, some sense. For once, I can agree with you. It's silly. I see no
point in enforcing a return statement in a function with void return
type, but in functions that are declared as returning a value, surely it
isn't asking too much of the programmer to require a value to be
returned (that is, for the lack of a return statement to be a constraint
violation).

I'd basically agree, but I think this ran into the "too much existing code'
problem.

-s
 
S

Seebs

Better - let the programmer fix it by changing the return type to void,
or by adding a return statement.

As an interesting special case, note the special handling for falling off
the end of main().

That said, I'd much rather have compilation abort than have the compiler
silently insert a return of a value that may well not be what I want.

-s
 
K

Keith Thompson

An interesting problem is for functions that are coded in such a way
as to make reaching the end of the function impossible. That may
happen in the case of a loop which will be exited from via a return
inside the loop, or be calling some functions (abort(), for example),
that will not return.

Neither case is easy (or in fact necessarily possible at all, since
they break down to the halting problem in the general case) for a
compiler to detect. That leaves the somewhat unpleasant requirement
of putting a dummy return statement at the end of such a function to
suppress the diagnostic (and many compilers do, of course, warn about
that). Probably a better approach would be a constraint specification
("__should_never_get_here__") that could be inserted by the programmer
that the compiler can understand, and toss some kind of exception if
it does happen.

One possibility would be to require, in any non-void function, a
return statement along all possible execution paths, so that it can be
proven at compile time that execution will never reach the closing
"}". For this, no run-time checking would be required.

It would require defining "all possible execution paths", preferably
in a fairly straightforward way so that compilers aren't required to
be *too* clever.

For example this:

int foo(void) {
if (something) {
return 0;
}
}

would be a constraint violation, whereas this:

void foo(void) {
if (something) {
while (1) {
twiddle(thumbs);
}
}
else {
return 0;
}
}

would not. This would require more control flow analysis than C
compilers have traditionally been required to do (but no more than
they typically do in practice).

Another possibility would be something like what Ada does. For the
equivalent of a non-void function, Ada requires a return statement
*somewhere* in the body of the function, even if it's never executed;
this is a compile-time requirement. It raises a run-time exception
if execution reaches the end of the function. C could require the
equivalent of a call to abort(). A compiler could omit the abort()
call from the generated code if it can prove that it will never be
reached. A big problem with this is that abort(), or even exit(),
isn't required for freestanding implementations.
 
K

Keith Thompson

Seebs said:
I'd basically agree, but I think this ran into the "too much existing code'
problem.

Going back to K&R C, where there were no void functions, the only
way to have a function that effectively didn't return a value was
by declaring without a return type (thus defaulting to int), and
just not returning anything.

But C99 already broke this by dropping implicit int and banning
an expressionless "return;" in a non-void function. I don't think
requiring a return statement in a non-void function would be much
of an additional burden. There would still be some details to work
out regarding how to define it (see my other article in this thread).
 
W

Walter Banks

spinoza1111 said:
So, you admit that the compiler can detect it. Good. Now the compiler
can fix it by generating an extra machine instruction to return a
zero.

The compiler would be hiding a programming error.

A compiler issued error message would be appropriate.

Regards,

w..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,801
Messages
2,569,658
Members
45,422
Latest member
KerryFalco

Latest Threads

Top