Wednesday, January 29, 2020

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

Bonita Montero <Bonita.Montero@gmail.com>: Jan 29 03:47PM +0100

With this:
 
#include <iostream>
#include <typeinfo>
 
using namespace std;
 
int main()
{
int A, C;
float B;
long long D;
int (*E)[];
cout << typeid(A + B).name() << endl;
cout << typeid(A + C).name() << endl;
cout << typeid(A + D).name() << endl;
cout << typeid(E).name() << endl;
}
 
... I get ...
 
float
int
__int64
int (* __ptr64)[0]
 
... with MSVC.
 
With g++ I get ...
 
f
i
x
PA_i
 
Does anyone know how to make gcc more expressive like MSVC?
red floyd <no.spam@its.invalid>: Jan 29 06:58AM -0800

On 1/29/20 6:47 AM, Bonita Montero wrote:
> x
> PA_i
 
> Does anyone know how to make gcc more expressive like MSVC?
 
You probably can't. The value of std::type_info.name() is
implementation defined.
Bonita Montero <Bonita.Montero@gmail.com>: Jan 29 03:59PM +0100

>> Does anyone know how to make gcc more expressive like MSVC?
 
> You probably can't.  The value of std::type_info.name() is
> implementation defined.
 
I know, but probably there's a compiler-switch.
Bonita Montero <Bonita.Montero@gmail.com>: Jan 29 04:44PM +0100

That's a workaround:
 
#include <iostream>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <string>
 
using namespace std;
 
int main()
{
unordered_map<type_index, string> typeMappings;
typeMappings[type_index( typeid(char) )] = "char";
typeMappings[type_index( typeid(unsigned char) )] = "unsigned
char";
typeMappings[type_index( typeid(signed char) )] = "signed char";
typeMappings[type_index( typeid(short) )] = "short";
typeMappings[type_index( typeid(unsigned short) )] = "unsigned
short";
typeMappings[type_index( typeid(int) )] = "int";
typeMappings[type_index( typeid(unsigned int) )] = "unsigned
int";
typeMappings[type_index( typeid(long) )] = "long";
typeMappings[type_index( typeid(unsigned long) )] = "unsigned
long";
typeMappings[type_index( typeid(long long) )] = "long long";
typeMappings[type_index( typeid(unsigned long long) )] = "unsigned
long long";
typeMappings[type_index( typeid(float) )] = "float";
typeMappings[type_index( typeid(double) )] = "double";
typeMappings[type_index( typeid(long double) )] = "long double";
 
int a, c;
float b;
long long d;
cout << typeMappings[type_index( typeid(a + b) )] << endl;
cout << typeMappings[type_index( typeid(a + c) )] << endl;
cout << typeMappings[type_index( typeid(a + d) )] << endl;
}
Melzzzzz <Melzzzzz@zzzzz.com>: Jan 29 04:05PM


>> You probably can't.  The value of std::type_info.name() is
>> implementation defined.
 
> I know, but probably there's a compiler-switch.
I can't remember but there is function to demangle typeid name...
 
--
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
Melzzzzz <Melzzzzz@zzzzz.com>: Jan 29 04:08PM

>>> implementation defined.
 
>> I know, but probably there's a compiler-switch.
> I can't remember but there is function to demangle typeid name...
 
Here it is:
https://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.3/a01696.html
--
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
boltar@nowhere.org: Jan 29 05:16PM

On Wed, 29 Jan 2020 15:47:43 +0100
>x
>PA_i
 
>Does anyone know how to make gcc more expressive like MSVC?
 
Its compiler dependant so no.
 
FWIW Clang gives the same output as gcc.
boltar@nowhere.org: Jan 29 05:17PM

On Wed, 29 Jan 2020 16:44:15 +0100
>That's a workaround:
 
Not sure you'd define creating a map with the long format as a "workaround" :)
Juha Nieminen <nospam@thanks.invalid>: Jan 29 07:51AM


>> Crap. "Similiar" mathematical techniques were first published in the
>> 17th century. CORDIC itself wasn't even conceived until the 20th.
 
> Are you autistic and don't understand emoticons ?
 
It's a smiley, not an "emoticon" (which would be a picture. No pictures
here).
 
Anyway, a smiley in such a message is extremely ambiguous. It could
quite well mean that you aren't saying the thing seriously, or it
could also mean that you are mocking the other person. It's impossible
to tell which, from the smiley alone.
 
Consider, for example, these two sentences:
 
"That's what she said. ;-)"
 
"Yeah, whatever you say, pal. And the Moon is made of cheese. ;-)"
 
One is jestful. The other is mockery. In this case it's clearer which is
which. However, it's not always so clear-cut.
"Öö Tiib" <ootiib@hot.ee>: Jan 29 12:58AM -0800

On Wednesday, 29 January 2020 09:52:08 UTC+2, Juha Nieminen wrote:
 
> It's a smiley, not an "emoticon" (which would be a picture. No pictures
> here).
 
Interesting ... why people do not use emoticons in Usenet? 🤔 😝
Bonita Montero <Bonita.Montero@gmail.com>: Jan 29 10:34AM +0100


>> Are you autistic and don't understand emoticons ?
 
> It's a smiley, not an "emoticon" (which would be a picture. No pictures
> here).
 
https://en.wikipedia.org/wiki/Emoticon#/media/File:Emoticon_Smile_Face.svg
 
> Anyway, a smiley in such a message is extremely ambiguous.
 
Maybe for autists, but normal people recognize the meaning,
even more with an additional "hrhr".
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: