Saturday, June 27, 2020

Digest for comp.lang.c++@googlegroups.com - 11 updates in 3 topics

guinness.tony@gmail.com: Jun 27 11:34AM -0700

On Saturday, 27 June 2020 17:40:46 UTC+1, jacobnavia wrote:
> c = a+b;
> }
 
> This compiles in the lcc-win compiler system.
 
Really? What meaning does lcc-win ascribe to this non-C code?
 
typedef struct { double real,double imag; } cmplx;
 
(C compilers complain about the word 'double' following the comma).
 
Are commas and semicolons interchangeable in struct definitions
when compiling under lcc-win?
David Brown <david.brown@hesbynett.no>: Jun 27 09:36PM +0200

On 27/06/2020 20:05, Paavo Helde wrote:
 
> The comma operator is essential for for. There are uncountably many for
> loop expressions using the comma operator and it can be never deprecated
> there.
 
It is not remotely "essential" - people write perfectly good, clear and
efficient "for" loops without the comma operator. But some people
/like/ to use the comma operator, and feel it makes their code
(especially "for" loops) better. Fair enough - it's a feature of the
language, and just one of many non-essential features that people use.
 
You are certainly right, however, that there is lots of existing code
with comma operators, which is why deprecating it (in any situation) is
something that will take time to be effective.
 
 
> For [] I agree: ',' does not mean comma operator inside (), [] should
> behave the same, just for symmetry. For lambda [] this already works so.
 
I think it would be more consistent to deprecate it in all places. But
I am fully aware that that is a personal opinion, and not one that is
likely to be implemented in practice.
Keith Thompson <Keith.S.Thompson+u@gmail.com>: Jun 27 04:20PM -0700

> Le 27/06/2020 à 16:51, Alf P. Steinbach a écrit :
>> On 27.06.2020 08:46, jacobnavia wrote:
[...]
 
> Now, I wanted to know how C++ manages multi-dimensional array access,
> and apparently it doesn't. So I have no c++ compatibility problem
> since there isn't anything there.
 
Neither C nor C++ supports multi-dimensional arrays as a distinct
concept.
 
In standard C, a multidimensional array is nothing more or less
than an array of arrays. You can also use table[2][5][2] notation
in contexts involving pointers rather than arrays.
 
C++ is pretty much the same, with the addition of operator
overloading. In C++, table[2][5][2] can be valid if each of
table[2][5], table[2], and table is of pointer type (possibly the
result of array-to-pointer conversion) or of some class type (which
includes struct or union type) with an appropriately overloaded
operator[].
 
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */
Frederick Gotham <cauldwell.thomas@gmail.com>: Jun 27 01:17PM -0700

[This post is equally relevant to C++ and C and so I'm multi-posting to comp.lang.c++ and comp.lang.c]
 
Fourteen years ago, the following thread was started on comp.std.c++:
 
https://groups.google.com/d/msg/comp.std.c++/uVbAnGYxclc/YXCwnpS1NogJ
 
You can see the contents of the original post below.
 
I'd like to ask if anyone still has the JPG image file referenced in the below post, or if there's any way at all of retrieving it?
 
 
On Monday, May 8, 2006 at 6:34:09 PM UTC+1, Tomás wrote:
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Jun 27 01:43PM -0700

On 6/27/2020 1:17 PM, Frederick Gotham wrote:
 
> https://groups.google.com/d/msg/comp.std.c++/uVbAnGYxclc/YXCwnpS1NogJ
 
> You can see the contents of the original post below.
 
> I'd like to ask if anyone still has the JPG image file referenced in the below post, or if there's any way at all of retrieving it?
 
The image is most likely gone forever. Unless something just happened to
archive it. Fwiw, James Kanze is very smart, I had a nice time
conversing with him.
 
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Jun 27 01:47PM -0700

On 6/27/2020 1:43 PM, Chris M. Thomasson wrote:
 
> The image is most likely gone forever. Unless something just happened to
> archive it. Fwiw, James Kanze is very smart, I had a nice time
> conversing with him.
[...]
 
Perhaps look for it on the wayback machine. Fwiw, it actually crawled an
old website that I used to have:
 
http://web.archive.org/web/20060213220325/http://appcore.home.comcast.net/
Bart <bc@freeuk.com>: Jun 27 10:05PM +0100

On 27/06/2020 21:46, Stefan Ram wrote:
> .---. .---. .---. .---.
> | o--------->| |<---------o | | a |
> '---' '---' '---' '---'
 
This may be fine for single pointers. The chances are that these
represent arrays and strings.
 
I started writing down the possible combinations of char** then realised
I wasn't quite sure what they all were!
 
The C type system really doesn't help. Looking at just the simplest
char* type, this could point to one character (a 0D array), or the first
of a sequence (a 1D array of char or a zero-terminated string). With the
possibilities with each extra * growing.
Mike Terry <news.dead.person.stones@darjeeling.plus.com>: Jun 27 10:44PM +0100

On 27/06/2020 21:46, Stefan Ram wrote:
> .---. .---. .---. .---.
> | o--------->| | | o--------->| a |
> '---' '---' '---' '---'
 
|*ppc = &c;
 
pp p ppc c
.---. .---. .---. .---.
| o--------->| o |<---------o | | a |
'---' '-|-' '---' '---'
| ^
| |
'-------------------------'
 
|*p = 'b';
 
pp p ppc c
.---. .---. .---. .---.
| o--------->| o |<---------o | | b?|
'---' '-|-' '---' '---'
| ^
| |
'-------------------------'
 
(but c is const)
 
Mike.
Richard Damon <Richard@Damon-Family.org>: Jun 27 06:02PM -0400

On 6/27/20 4:46 PM, Stefan Ram wrote:
> | o--------->| | | o--------->| a |
> '---' '---' '---' '---'
 
> |*p = 'b';
 
shouldn't that be: (for *ppc = &c; )
 
pp p ppc c
.---. .---. .---. .---.
| o--------->| o |<---------o | | a |
'---' '-|-' '---' '---'
| ^
|_________________________|
 
and it is the
const char** ppc = pp;
that is currently not allowed, and causes the issue, as it means that
*ppc has type (const char*), and thus accepts the address of a const
char, but it also is *pp which has type char* so **pp (or *p) is seen as
a writeable char object, which it isn't.
ram@zedat.fu-berlin.de (Stefan Ram): Jun 27 08:46PM

Frederick Gotham <cauldwell.thomas@gmail.com> quoted:
|const char c = 'a';
|char* p;
|char** pp = &p;
|const char** ppc = pp;
 
pp p ppc c
.---. .---. .---. .---.
| o--------->| |<---------o | | a |
'---' '---' '---' '---'
 
|*ppc = &c;
 
pp p ppc c
.---. .---. .---. .---.
| o--------->| | | o--------->| a |
'---' '---' '---' '---'
 
|*p = 'b';
 
)=@V Yrkoc36$6* #rl_AG}"53x8]E i&y9R{KmqvqF~
@Bqv~~o?gx|\<wI!SXOV:^]q+sIjeyi(<H{K-KWm"x/t
a?<lk?hp?+xtTB,JdG\pU9O'vvFw=d(*7P?i4cW{AYYB
1,DCxI8=kU:db\F;*r^9!6hpo,"0#Ja(XK&|+4G(X@N#
ram@zedat.fu-berlin.de (Stefan Ram): Jun 27 09:50PM

> | ^
> | |
> '-------------------------'
 
You're right!
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: