Compile C Code With A CPP Compiler?

D

Default User

Mike said:
I don't see them either. Perhaps a major trunk is down,
and only servers in a paritcular physical region are getting
them? I'm no networking expert, just a thought.


Google doesn't have them either. Elsethread speculation is malformed
headers. Other Plauger messages are showing up on google.




Brian Rodenborn
 
M

Mark McIntyre

What important error to you mask when you cast a pointer known to
be a void * to one that can only be assigned to a pointer of the
expected type?

We all know the error, but more to the point, what (apart from C++
compatibility) do you *gain* from it? IMHO it merely increases the
amount of maintenance you have to do. And what are you doing using
malloc in C++ anyway?

PJ we all know your reputation, and surely bow to it. But EXCEPT when
deliberately trying to generate code that compiles as both C and C++
(which frankly I think is fraught with serious danger), can you think
of a reason to do this? I can't.
 
M

Mark McIntyre

Sorry, but the reason is to excellent for me to grasp. Me and my
pet camel find this to be quite sensible code.

I believe you've been hanging around here long enough to know
perfectly well what are the objections. You're trolling.... :)
 
M

Mark McIntyre

Where does that leave comments?

in the "do something good or stop something bad from happening"
bracket or deleted during the review phase.
Examples
// don't delete this, it forces the fscking stoopid linker to include
// floating point maths
double d = 12.456;

// munge the frobozz into a tweedle, if and only if the
// morple was less than two twips beyond the flunge
z = foobar( x? y ? z? q? a: b: c: d:e, mu, zork->dwibble->gloink);

But they're not code anyway, they're whitespace. :)
But it does reassure the reader that you know what kind of storage
you're trying to allocate.

And do you therefore cast all assignments?
int p;
p = (int) 11; // to reassure idiots that we know what type p has

Ludicrous example of course, but you get the point I'm sure.
And it causes a compile-time diagnostic
if you later change the type of the pointer you're assigning to,
without changing the sizeof to match.

Meanwhile the CLC method requires neither change nor the diagnostic,
since by magic it all fixes itself. Self maintaining code. My
favorite.
 
R

Richard Bos

P.J. Plauger said:
I post using Reply Group in Outlook Express, through news.alterdial.uu.net.

Which would explain why I _am_ seeing them, since I'm on news.nl.net,
which is run by the Dutch branch of UUNet.

Richard
 
J

Joona I Palaste

Trust me Trollsdale, if you aren't in it, Plauger certainly isn't.

Trollsdale is in my killfile but Plauger isn't. I don't even have to
check it. Tin nicely shows whether it never got the message or it just
doesn't want to show it to me:

Original message Some author(1)
+-> Some other author(2)
| +-> Yet another author(3)
`-> Last author(4)

In this case the "`->" marks the last reply to a particular message
in a thread. Notice how there isn't one between (3) and (4) even
though (3) is a reply to (2). That's because the hypothetical author
of the second reply to (2) has been killfiled, just like Trollsdale.
If someone were to reply to Trollsdale, I mean the hypothetical
author, it would show up as:

Original message Some author(1)
+-> Some other author(2)
| +-> Yet another author(3)
| `-> Reply to killfiled author(6)
`-> Last author(4)

Which would show that (6) was a reply to an invisible message, not to
(3). This is what is happening with Trollsdale but it's not what's
happening with Plauger.

--
/-- Joona Palaste ([email protected]) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"It's time, it's time, it's time to dump the slime!"
- Dr. Dante
 
R

Richard Bos

Richard Heathfield said:
[PJP's article didn't show up on my server yet, hence the (partial)
piggy-backing.]

Richard said:
What a nonsensical reaction! No, we should avoid writing C which is iffy
for no better reason than that it's also legal (but iffy) C++.

I agree with all but the first four words. I think we should respect the
fact that P J Plauger is an expert on the C language, even if we happen to
disagree with him on this issue.

I certainly respect him as well, which is why I'm surprised and dismayed
that he'd take your objection to such ludicrous extremes. I hadn't
expected this from him; he doesn't need straw men.
Not having the original in front of me, I can't tell what you mean for
certain, but if the original layout was: int* p = malloc..., I don't think
it's a big deal, especially if declarations are kept one to a line (which
is my own preference).

It may not be a big deal, but the above _is_ clearer than the
alternative.
Clearly, Mr Plauger's mileage varies, and I'm not
about to suggest that he changes his business's development strategy on the
basis of a newsgroup discussion! Nevertheless, I can't see myself advising
anyone to adopt that strategy any time soon.

I think this is the crux: Mr. Plauger supplies a market that most of us
have nothing to do with, and which probably has its own demands. Most of
us write programs for ourselves or for customers, with no need for it to
be compilable on both C and C++ compilers, and in those, more usual
circumstances, the cast is to be avoided.

Richard
 
D

Dan Pop

In said:
Richard said:
[PJP's article didn't show up on my server yet, hence the (partial)
piggy-backing.]

I haven't seen ANY of his messages, but lots of replies to them. Not
sure what's up with that.

Neither have I, for quite a while: only replies to his posts.

Dan
 
D

Dan Pop

In said:
I think this is the crux: Mr. Plauger supplies a market that most of us
have nothing to do with, and which probably has its own demands. Most of
us write programs for ourselves or for customers, with no need for it to
be compilable on both C and C++ compilers,

Since practically every C++ compiler is accompanied by a C compiler, I can
see no need for writing code that is compilable on both C and C++
compilers. C++ compilers have a *standard* mechanism for calling
functions compiled by a compatible C compiler.

Dan
 
C

CBFalconer

Richard said:
Which would explain why I _am_ seeing them, since I'm on
news.nl.net, which is run by the Dutch branch of UUNet.

Has anybody considered that the so-called original may well have
been a spoof. After all, from all accounts it recommended an
unclean practice. Someone somewhere may have detected the spoof
and killed it.
 
R

Richard Heathfield

Richard said:
I certainly respect him as well, which is why I'm surprised and dismayed
that he'd take your objection to such ludicrous extremes. I hadn't
expected this from him; he doesn't need straw men.

I must admit that I was rather surprised, too. It is true that he is in a
rather different market to the rest of us, of course, but I must admit I'm
rather taken aback by his position here. I have been trying to think of a
good reason why anyone as clueful (and lots of other positive adjectives)
as PJP would want to follow such a strange policy. I didn't succeed.
 

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
474,085
Messages
2,570,597
Members
47,218
Latest member
GracieDebo

Latest Threads

Top