Sunday, April 26, 2020

Digest for comp.lang.c++@googlegroups.com - 10 updates in 4 topics

jacobnavia <jacob@jacob.remcomp.fr>: Apr 19 03:21PM +0200

Le 19/04/2020 à 14:42, Öö Tiib a écrit :
 
>> A recent paper shows that Rust has the same problems as C or C++.
 
>> https://arxiv.org/pdf/2003.03296.pdf
 
> I am maybe misunderstanding what I read again but huh.
 
No, it is simply that your evangelical positions are getting upset.
 
> Is it really article that states that stuff in Rust encapsulated in
> unsafe{ ... } is unsafe?
 
Exactly. But why are those unsafe APIs necessary?
 
Because they are essential. And that means that Rust has the same
problems than C with usage after free() etc.
 
Is it really meant to distribute FUD
> against Rust?
 
No, it is an investigation of Rust's claims and its FUD about C.
 
 
> Appearance of such clearly mud slinging articles
> has always indicated that target is doing far stronger than I
> thought and it is time to invest into it!
 
Evangelist position noted...
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Apr 19 09:39PM +0100

On Sun, 19 Apr 2020 21:35:15 +0100
> Destructors are not in tail position.
 
Err, only the last destructor is in tail position and the recursive call
is not.
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Apr 20 08:12PM +0100

On Mon, 20 Apr 2020 18:08:18 +0200
> interface functions. The only thing you need to do is a mapping from the
> C types to the Rust types.
 
> I have done that and is absolutely doable...
 
Rust already has an FFI for C. It doesn't need another. The point is
that if you call into C code then your Rust code cannot be any safer
than your C code.
James Kuyper <jameskuyper@alumni.caltech.edu>: Apr 20 10:23AM -0400

On 4/20/20 9:20 AM, Juha Nieminen wrote:
> C++ doesn't allow implicitly casting between incompatible
> pointer types while C does, but doing so in C is often frowned
> upon in programming style guidelines.)
 
<pedantic>A cast is a particular piece of syntax. That syntax in the
source causes the implementation to generate code which implements the
corresponding conversion. That syntax is not always required in order
for the conversion to occur. When that is the case, it's called an
implicit conversion, not an implicit cast - because it isn't a cast
without that syntax, but it is still a conversion.</pedantic>
 
Your wording could be interpreted as implying that incompatibility is
not a barrier to C pointer conversions. In fact, in most cases it is a
barrier. Such a conversion is allowed only if one of the two types is
void*. Many people consider this an advantage - creating that advantage
was one of the purposes behind the invention of "void*", though Bjarne
clearly disagreed. Those people write programming style guidelines that
reflect that opinion.
Richard Damon <Richard@Damon-Family.org>: Apr 19 09:31AM -0400

On 4/19/20 8:39 AM, Paavo Helde wrote:
 
> This paper compares Rust with an hypothetical language called C/C++.
> There is no such language in existence, which makes the whole paper a
> bit suspect.
 
But C and C++ are very related languages, so there IS a language family
that can be described as C/C++, and there is a common core that is
common between the two languages. C++ adds a number of features, that
when used can abstract out may of the things that cause one class of
memory errors, but at the same time adds a layer of complexity that
might enable others.
 
C++ also doesn't force you to use the abstractions that help eliminate
some of the memory problems, but allows you to do the low level
operations that open the door to memory access issues, and in fact the
abstractions tend to be based on using those lower level operations, its
just that the scope of those operations are tried to be kept smaller so
it is hopefully easier to reason that it is being done correctly.
Melzzzzz <Melzzzzz@zzzzz.com>: Apr 19 08:40PM

> [snip]
 
> I don't write Rust code. I am merely interested in its type system (as
> are a number of other languages, now).
 
Heh in 2013 or so I submitted patch in Rust compiler to fix inheritance in Vtable
bug :P
 
 
 
--
press any key to continue or any other to quit...
U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec
Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi -- Zli Zec
Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi
bili naoruzani. -- Mladen Gogala
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Apr 20 12:37AM +0100

Sausages. That is all.
 
/Flibble
 
--
"Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin
 
"You won't burn in hell. But be nice anyway." – Ricky Gervais
 
"I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais
 
"Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Byrne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say."
Vir Campestris <vir.campestris@invalid.invalid>: Apr 18 09:53PM +0100

On 17/04/2020 14:41, James Kuyper wrote:
> it predates C++, going all the way back to the early days of C.
> Experienced C and C++ programmers are necessarily used to this problem,
> and know how to deal with it.
 
Interesting. I think I count myself as experienced - I've been writing C
and C++ for nearly 40 years - and yet it's never bitten me.
 
probably because
short plus = 42;
short minus = -plus;
 
tends to end up as something like
 
load 16 into register
store into plus as 16 bit
negate
store into minus as 16 bit
 
This case where
auto minus = -plus;
results in a 32 bit (or more!) size for minus is to me just another
reason not to use auto where I can avoid it.
 
Andy
Christian Gollwitzer <auriocus@gmx.de>: Apr 18 07:14PM +0200

Am 17.04.20 um 17:34 schrieb Ben Bacarisse:
 
> It may be simpler to fall into the trap in that case, but there are so
> many others (~42_i16, 42_i16 + 10, 42_i16 << 1, printf("...", 42_i26))
> that knowing the underlying truth really helps.
 
I've designed a Matlab-like language, and the integer promotion rules
also got me thinking. In the end I concluded that the base integer type
(like int in C++) should be disctinct from the fixed-widths types and
treated as an ideal integer. i.e., even if int== int32_t, the type
promotion should not widen smaller types in this case.
 
Therefore (in my language):
 
auto x = -42i16;
// x is -42i16
// unary - is defined for int16_t -> int16_t
 
auto i = x + 1
// i is -41i16
// no promotion, because int is special
 
auto j = x + 1i32;
// j is -41i32
// promoted because int32_t has more bits than int16_t
 
uint8_t byte=0;
auto t = byte - 1;
// t is 255u8
 
auto u = byte - 1i32;
// u is -1i32
 
Christian
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Apr 18 08:46PM +0100


> See how Christ was at work in her life, even through the
> bad times, even when she had given up.
 
> We all need that rope she talks about.
 
Fuck. Off.
 
/Flibble
 
--
"Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin
 
"You won't burn in hell. But be nice anyway." – Ricky Gervais
 
"I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais
 
"Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Byrne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say."
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: