Saturday, July 22, 2023

Digest for comp.lang.c++@googlegroups.com - 6 updates in 1 topic

Malcolm McLean <malcolm.arthur.mclean@gmail.com>: Jul 22 01:21AM -0700

Windows Visual C++ is now rejecting typedefed structures without tags.
 
e.g the following code
 
typedef struct
{
double x;
double y;
} Point;
 
clang still accepts it.
 
Anyone more information on this?
Bonita Montero <Bonita.Montero@gmail.com>: Jul 22 11:20AM +0200

Am 22.07.2023 um 10:21 schrieb Malcolm McLean:
> double x;
> double y;
> } Point;
 
I can compile this with current MSVC and -std:C++14, -std:C++17
and -std:C++20.
Keith Thompson <Keith.S.Thompson+u@gmail.com>: Jul 22 03:45AM -0700

> } Point;
 
> clang still accepts it.
 
> Anyone more information on this?
 
What's the error message?
 
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */
Malcolm McLean <malcolm.arthur.mclean@gmail.com>: Jul 22 04:21AM -0700

On Saturday, 22 July 2023 at 11:45:23 UTC+1, Keith Thompson wrote:
 
> > clang still accepts it.
 
> > Anyone more information on this?
> What's the error message?
 
It broke on an Azure build.
(Azure is a system which hosts compilers in the cloud. I develop on the Mac then submit
the programs. Azure builds a Windows compatible version. But I can't easily regenerate
the error message.) It was something like struct tag missing.
David Brown <david.brown@hesbynett.no>: Jul 22 05:50PM +0200

On 22/07/2023 10:21, Malcolm McLean wrote:
> } Point;
 
> clang still accepts it.
 
> Anyone more information on this?
 
Pasting it into godbolt and testing with the latest MSVC does not
complain. But I don't know the command-line switches involved.
 
Perhaps you have particular switches that make it reject this, even
though it is valid code (AFAIK) ?
Malcolm McLean <malcolm.arthur.mclean@gmail.com>: Jul 22 09:34AM -0700

On Saturday, 22 July 2023 at 16:50:40 UTC+1, David Brown wrote:
> complain. But I don't know the command-line switches involved.
 
> Perhaps you have particular switches that make it reject this, even
> though it is valid code (AFAIK) ?
 
With Azure pipelines the pipeline is usually set up by other people who
choose the compiler version and the flags. This avoids a situation in which
a developer sets various esoteric options on his desktop and creates an
executable, which can't be replicated by anyone else. But the disadvantage is
that you don't actually know how it's been set up.
 
But something has gone wrong. I cut and pasted C circle drawing code into a .cpp
file. And it rejected the typedef. When I converted the structure to the C++
idomatic form ( struct MyStructure { }; ), it was accepted.
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: