NULL and zeros

C

Clever Monkey

Frederick said:
Keith Thompson posted: [...]
What I wrote at the time, and what I meant and still mean, is that I
find Frederick's use of things like "char unsigned" rather than the
more common "unsigned char" to be needlessly contrary to common usage.

I have no problem whatsoever with your opinion regarding "char unsigned" --
my only problem pertains to the way in which you express yourself. The
words, "needlessly contrary" sound belittling to my ear, as if my personal
taste doesn't warrant consideration.
Dude. He /did/ consider your personal choice. And it came up lacking.
The problem here is really that you are investing too much in what
people think of your /code/. This is dangerous for your mental health.

Your code would be "needlessly contrary" to me, too. If you checked in
code that did this, I'd reject the changes and ask you why you would do
such a thing. This is a good thing, and well-accepted. Code is a
precious thing, and a shop needs to guard against style creep.
The reason I prefer "char unsigned" is that I have been learning a
particular human language for the past few years which puts the information
in order of descending importance -- and I find it quite prefereable over
the English way of doing things. I have become accustomed to it.
Fair enough. As I said, it sticks out at me, too, and would not fly in
this shop. I'd certainly use "perverse" to describe it, but if you are
coding for yourself, who cares.

I would not recommend it to a newbie, however.
When have you ever heard someone respectfully label someone else's efforts
as "perverse"?
Actually, all the time. I suspect technical people use the word
"perverse" the same way they use the word "egregious" or "ugly".
Usually to denote some sort of needlessly complicated or inelegant
examples. Something like changing a completely expected ad hoc standard
simply on a whim for no obvious gain (for the rest of us) is something I
would feel comfortable labelling "perverse", in the context of hacking.

This is not unlike how some technical people use the word "nazi" or
"fascist" in the tech world, though these terms are usually reserved for
far more extreme situations where actual vitriol or nastiness is intended.

Coders are hard on each other, especially when reviewing code. Learn to
dissociate yourself from the code you write, or be prepared for a whole
new world of unnecessary pain.

See The Jargon File.
It was taken as a personal insult purely on the grounds of your choice of
wording.
I don't get this. Why are you so closely invested in your coding style
that criticism of it is criticism of you? How can a C coding style be
so fundamental to your sense of self?

I'm not being a smart-ass here. This is a real question. It seems
unnecessarily perilous to align yourself so personally with how text
intended for a compiler is arranged on a text editor.
"C==v" has benefits over "v==C", yet you don't care.
For the record, I sometimes do the former, but only because this shop
uses it and our code is nearly 20 years old in places.

However, this does not address the question of whether or not someone
should "care". I'm not sure what you mean to say with this comment.

Again, this is coding standard talk, which is, in the vernacular, a
"holy war". It is pure luck which crusader for which side you run into
when you post your coding standards on your shield. Expect bruises.
Indeed, I had no intention to compare you to the aforementioned persons.
And I myself find it quite bewildering that the word, "fascist", has become
taboo simply because it was used to describe a few bad people.
I think the argument is not so much that there is a taboo against using
the word, but that the word is not yet freely available for use in a
forum where your intent may not by immediately understood. The word
means something, and that literal meaning is what people may go on
regardless of what you were thinking.
I don't believe in empty apologies. I shall not apologise for offending
you, because I had no intention to do so.
This is illogical. An empty apology is one you simply don't mean. If
you don't want to apologize then so be it. Trying to convince yourself
*why* you shouldn't because

- you didn't mean it
- the dog ate it
- I got a flat tire
- but taking what I want *is* sharing

just doesn't wash. I'm sorry, but any child is expected to know this.

One apologizes because they see that they have done something wrong, and
perhaps they empathize with what the other person might have felt. It
is the realization that it is the other person that matters, and not
one's own feelings or intent, that is at the root of an apology.

Lack of intent or misunderstanding are merely mitigating factors; they
do not render the apology moot.

Many people die each day because of unintended actions by other people.
It is not the intent that is at the root of the notion of "fault".

If you do not feel you are at fault, so be it. Don't construct reasons
based on what you "meant" to prove why or why not you are at fault.
However, given that you were offended, I will offer an apology in the
spirit of good relations, and will apologise for the reality that you were
offended by my statement: Sorry.
Exactly.

I'll refrain from adding any further to this novella.
 
C

Christopher Layne

CBFalconer said:
So what else do you call someone who advocates and implements
totalitarian government, death camps, ethnic cleansing, and so on
and so forth?  How soon the society forgets.  This leads to such
things as the Iraq situation.

melodrama.
melodrama.
melodrama.

Either figure out a metaphor or take it literally and cry about it. Death
camps, ethnic cleansing. Come on!
 
C

Christopher Layne

Richard said:
Speaking as someone whose wife's family suffered considerable persecution at
the hands of the Nazis, I hope this kind of thing doesn't happen in
comp.lang.c again. Ideas matter - even bad ideas, such as Fascism - and
ideas are expressed in words; therefore, words matter too, and so people
should choose them carefully.

Sorry. People will be allowed to use the word 'fascist' in comp.lang.c until
the day it dies. Keith and you CHOSE to make it into a literal dramatic
escapade. Do you seriously think that Frederick was even inciting anything
about Hitler, Stalin, etc.? Should we stop all use of metaphor, idioms, and
symbolism now that people are going to take them literally and not be
pragmatic about it?
 
C

Christopher Layne

James said:
Today, the word 'fascist' is more-or-less synonymous with "authoritarian
asshole." And it's become acceptable to call almost any asshole "a
nazi", like the "door nazi" at a department store, or the "soup nazi" on
Seinfeld.
It is my opinion that the dilution of these words is the result of an
effort to alter the impact of these words by the very people who seek to
practice the same ideologies without being subject to certain forms
criticism.

Based on that logic - Seinfeld wants to be a nazi?
 
C

Christopher Layne

Clever said:
Furthermore, the modern usage is definitely meant only in an ironic or
humorous manner.

Just as fascist is. Are you seriously going to sit here and tell me
that "fascist" is somehow worse than "slave driver?"
 
M

Mark McIntyre

Common to native English speakers, perhaps. As far as I
know, Frederick is Irish.

What language do you think is the common tongue of Ireland? You may
pick either the Republic or the Province.
Since when is Irish ``English''?

Since when did I say they were? Try reading for comprehension.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
I

Ian Collins

Christopher said:
Richard Heathfield wrote:




Sorry. People will be allowed to use the word 'fascist' in comp.lang.c until
the day it dies. Keith and you CHOSE to make it into a literal dramatic
escapade. Do you seriously think that Frederick was even inciting anything
about Hitler, Stalin, etc.? Should we stop all use of metaphor, idioms, and
symbolism now that people are going to take them literally and not be
pragmatic about it?

It's pretty obvious from what has been argued here that fascism still
has extremely unpleasant associations for many people. As such, it's an
unnecessary term best avoided in a forum such as this. Fredrick's
admitted ignorance of that dark period of history probably explains his
incredulity at the strong reactions his use of the term provoked

By the way, Stalin was at the opposite and equally unpleasant end of the
political spectrum from the Fascists.
 
R

Richard Heathfield

Christopher Layne said:
Sorry. People will be allowed to use the word 'fascist' in comp.lang.c
until the day it dies.

Yes, it's called "freedom of speech", and it's something I think of
paramount importance. I'm sure Keith does too. (Fascists don't, by the
way.)

But people are also allowed to show consideration for others by what they
choose *not* to say.

They aren't forced to, but they're allowed to, and they are the more
respected if they choose to exercise that option.
 
Y

Yevgen Muntyan

Christopher said:
I think gvim will do it, FWIW.

gvim hides *only* lines with obj->this = NULL; (e.g. not some
obj->that = 8) without huge amount of learning of whatever
scripting or something is used in vim? Would be interesting to know
how to achieve this even using all the machinery used in vim
though (I'd guess it may be some regular expression for hidden
lines, but they would need to include *argument* to the init()
function or an object allocated with calloc/g_new0, and this
seems non-trivial). Maybe gvim includes some advanced facilities
for parsing C code, then I'd guess it's very difficult to use
those.
How about

struct Stuff *s = calloc (1, sizeof *s );

How about

MyType *thing = g_new0 (MyType, 1);

Or is it really important to use "sizeof *var" in example
code just for sake of using it?
I even *always* use brackets with sizeof, I like its function-like look
which makes it clear what sizeof is applied to.
IMHO it would be helpful to just add something similar to "Assume that
calloc() initializes all pointers to NULL", on the off chance that
at some grim future time that assumption turns out to be false and
some unfortunate soul is tasked with figuring out where the code is
broken.

True, question is how feasible that situation is. E.g. a comment
telling "this code assumes non-existence of alien civilizations" is
clearly nonsense. So there should be some line, but where is it?
It's surely off-topic here, standard does mention NULL and doesn't
mention aliens so it's clear what standard thinks about this situation
:)

Best regards,
Yevgen
 
Y

Yevgen Muntyan

Robert said:
On Thu, 5 Oct 2006 13:00:03 +0000 (UTC),



Wrong. By replacing calloc() by malloc() and adding two more lines,
the struct variable can be initialized to reasonable "null" values (0
for ints, NULL for pointers, 0.0 for floats) reliably and portably.

No need for comments explaining assumptions.

Whole thread (well, half of it) was about this, and there's a
situation where you can't replace calloc with malloc, or where
a structure has twenty members, and so on. This comment advice
is not that unreasonable.

Regards,
Yevgen
 
T

Tak-Shing Chan

What language do you think is the common tongue of Ireland? You may
pick either the Republic or the Province.

If I recall correctly, Frederick prefers ``char unsigned''
because this is the ordering in Irish.
Since when did I say they were? Try reading for comprehension.

Frederick is a ``non-English'' speaker although he is not a
``non-English-speaker'' (note the hyphens).

Tak-Shing
 
T

Tak-Shing Chan

CBFalconer, kindly do me a favour and [snip]. Many people have insulted me
on this newsgroup, too many to name, but I'll start the list of recent ones:

Keith Thompson
Richard Heathfield
Mark McIntyre

and of course, you. [snip]
I couldn't care less whether they
apologise, so long as I get what I come here for -- interesting discussion
pertaining to C programming.

The four people cited above have been a major source of
interesting C discussions over the past many years. By cutting
them off you are depriving yourself of what you come here for.

The ``insulting'' culture on comp.lang.c is probably due to a
certain Mr. Dan Pop, who was very influential here in the 1990's.
It is a historical baggage.

Tak-Shing
 
C

Chris Dollin

Christopher said:
There's no need to quote the entire article - which is why it's a useful
feature.

My computer has a delete key and other wordbegone features, which I'm
quite capable of using to trim messages I'm replying to. This means
I'm not limited to an all-but-this-contiguous-sequence edit.
 
C

Chris Dollin

Clever said:
Compounding the glory that is OT, are we referring to the board game
here, or is there also a computer version thereof?

I don't believe there is a computer version.
I've given thought of adding AoS to my shelf of games for the upcoming
cold winter nights in with the missus.

AoS is a truly excellent game, but it needs at least three players.
 
M

Mabden

Richard Heathfield said:
You can start by thinking about apologising to Keith for behaving abusively
and libellously towards him in this newsgroup.

We have do do THAT......
OY!

.....sorry keith :(
 
M

Mabden

Richard Heathfield said:
Christopher Layne said:


No, it isn't. The difference is significant.

Talking about a system of government and associating a certain leader who
abused that power is not the same thing. The Romans invented the Dictator to
solve their problems and it worked well for many years. Now it is seen as a
"Bad Thing".

"What about all the Good Things Hitler did?!"
http://www.tshirthell.com/store/product.php?productid=192

You've probably riden in or known someone with a Volkswagen. Hitler made
that happen. Hitler proved many scientific facts - his soldiers made ice
cream in the desert to prove how that can happen. He also did unspeakable
things to twins, for some reason. He was weird. But he certainly had a lot
of ideas, and for a postal clerk in the 1930's I would say he had more ideas
than YOU have now about future tecnology. Sick? yes. Thinker? OH YES.

Don't email me - I have been to the concetration camps - It was real folks.
And very terrible. Like, you don't eat afterwards. You don't talk. You go
with 3 friends and the ride back is silence. It's gross. It's horrible.
Going in person is something people should do once in their lives. Go! See
the "showers" that the gases came from, see the ovens bigger than any pizza
oven you've seen and the back door to the oven. Then look at the trench that
contained the bones and ash. See the pictures of the starving
inmates. Walk the length of the walls and see a cell contining X people in
the size of your bathroom / closet.
If you go, you won't forget. and you won't wonder if it "really" happened.
 
C

Clark S. Cox III

Yevgen said:
Whole thread (well, half of it) was about this, and there's a
situation where you can't replace calloc with malloc, or where
a structure has twenty members, and so on. This comment advice
is not that unreasonable.

As posted else-thread, the number of members is irrelevant:

static const Stuff empty_stuff = {0};
struct Stuff *s = malloc(sizeof *s);
*s = empty_stuff;

Stuff could have 1000 members for all I care, and they will all be set
to 0, 0.0 or NULL depending on their type. You do not have this
guarantee with calloc.
 
D

Dik T. Winter

>
> If I recall correctly, Frederick prefers ``char unsigned''
> because this is the ordering in Irish.

He has stated he prefers that because he wants to emphasise the type.
In all his writings, language did not come in.
 

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

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,265
Latest member
TodLarocca

Latest Threads

Top