* typesafe symbols for C
@ 2011-01-03 5:44 Enrico Weigelt
2011-01-03 13:25 ` Jonathan Wakely
0 siblings, 1 reply; 5+ messages in thread
From: Enrico Weigelt @ 2011-01-03 5:44 UTC (permalink / raw)
To: gcc-help
Hi folks,
is it somehow possible to let the C-compiler include some type
information into symbol names (as IMHO done for C++) ?
If not, what would have to be done for that ?
cu
--
----------------------------------------------------------------------
Enrico Weigelt, metux IT service -- http://www.metux.de/
phone: +49 36207 519931 email: weigelt@metux.de
mobile: +49 151 27565287 icq: 210169427 skype: nekrad666
----------------------------------------------------------------------
Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme
----------------------------------------------------------------------
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: typesafe symbols for C
2011-01-03 5:44 typesafe symbols for C Enrico Weigelt
@ 2011-01-03 13:25 ` Jonathan Wakely
2011-01-29 22:33 ` Enrico Weigelt
0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2011-01-03 13:25 UTC (permalink / raw)
To: weigelt, gcc-help
On 3 January 2011 05:37, Enrico Weigelt wrote:
>
> Hi folks,
>
>
> is it somehow possible to let the C-compiler include some type
> information into symbol names (as IMHO done for C++) ?
I don't think so.
> If not, what would have to be done for that ?
Use a C++ compiler.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: typesafe symbols for C
2011-01-03 13:25 ` Jonathan Wakely
@ 2011-01-29 22:33 ` Enrico Weigelt
2011-01-31 10:56 ` Andrew Haley
0 siblings, 1 reply; 5+ messages in thread
From: Enrico Weigelt @ 2011-01-29 22:33 UTC (permalink / raw)
To: gcc-help
* Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 3 January 2011 05:37, Enrico Weigelt wrote:
> >
> > Hi folks,
> >
> >
> > is it somehow possible to let the C-compiler include some type
> > information into symbol names (as IMHO done for C++) ?
>
> I don't think so.
hmm. where should I start if I wanted to add that ?
> > If not, what would have to be done for that ?
>
> Use a C++ compiler.
hmm, maybe that's worth a try, but I doubt that all plain-C code
will compile fine then.
cu
--
----------------------------------------------------------------------
Enrico Weigelt, metux IT service -- http://www.metux.de/
phone: +49 36207 519931 email: weigelt@metux.de
mobile: +49 151 27565287 icq: 210169427 skype: nekrad666
----------------------------------------------------------------------
Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme
----------------------------------------------------------------------
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: typesafe symbols for C
2011-01-29 22:33 ` Enrico Weigelt
@ 2011-01-31 10:56 ` Andrew Haley
2011-01-31 12:29 ` Jonathan Wakely
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Haley @ 2011-01-31 10:56 UTC (permalink / raw)
To: gcc-help
On 01/29/2011 08:51 PM, Enrico Weigelt wrote:
> * Jonathan Wakely<jwakely.gcc@gmail.com> wrote:
>> On 3 January 2011 05:37, Enrico Weigelt wrote:
>>>
>>> Hi folks,
>>>
>>>
>>> is it somehow possible to let the C-compiler include some type
>>> information into symbol names (as IMHO done for C++) ?
>>
>> I don't think so.
>
> hmm. where should I start if I wanted to add that ?
>
>>> If not, what would have to be done for that ?
>>
>> Use a C++ compiler.
>
> hmm, maybe that's worth a try, but I doubt that all plain-C code
> will compile fine then.
It will be very close. One really good use of C++ is as C with
type-safe linkage.
Andrew.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: typesafe symbols for C
2011-01-31 10:56 ` Andrew Haley
@ 2011-01-31 12:29 ` Jonathan Wakely
0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Wakely @ 2011-01-31 12:29 UTC (permalink / raw)
To: Andrew Haley; +Cc: gcc-help
On 31 January 2011 09:38, Andrew Haley wrote:
> On 01/29/2011 08:51 PM, Enrico Weigelt wrote:
>>
>> * Jonathan Wakely<jwakely.gcc@gmail.com> wrote:
>>>
>>> On 3 January 2011 05:37, Enrico Weigelt wrote:
>>>>
>>>> Hi folks,
>>>>
>>>>
>>>> is it somehow possible to let the C-compiler include some type
>>>> information into symbol names (as IMHO done for C++) ?
>>>
>>> I don't think so.
>>
>> hmm. where should I start if I wanted to add that ?
>>
>>>> If not, what would have to be done for that ?
>>>
>>> Use a C++ compiler.
>>
>> hmm, maybe that's worth a try, but I doubt that all plain-C code
>> will compile fine then.
>
> It will be very close. One really good use of C++ is as C with
> type-safe linkage.
Annex C of the C++ standard lists incompatibilities between C and C++.
Among the commonly-used C features which won't work in C++ are:
Implicit conversions from integer types to enum types.
Implicit conversions from void* to other pointer types, which most
often causes problems in malloc statements:
Valid in C but not in C++:
char* buf = malloc(sz);
Valid in C and C++:
char* buf = (char*) malloc(sz);
C++ has additional keywords, so 'new' is not a valid identifier in C++
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-01-31 10:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-03 5:44 typesafe symbols for C Enrico Weigelt
2011-01-03 13:25 ` Jonathan Wakely
2011-01-29 22:33 ` Enrico Weigelt
2011-01-31 10:56 ` Andrew Haley
2011-01-31 12:29 ` Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).