Re: why is casting malloc a bad thing?

From: Dan Pop (Dan.Pop_at_cern.ch)
Date: 01/30/04


Date: 30 Jan 2004 16:54:04 GMT

In <bvdkd5$7ar$2@news.tudelft.nl> Sidney Cadot <sidney@jigsaw.nl> writes:

>Daniel Haude wrote:
>
>> On Thu, 29 Jan 2004 01:08:46 +0100,
>> Sidney Cadot <sidney@jigsaw.nl> wrote
>> in Msg. <bv9iug$lup$1@news.tudelft.nl>
>>
>>>That way, I don't have to rely on the semantics of C with regard to
>>>allowing void*-to-any* assignments,
>>
>>
>> When programming in C you have to rely on the semantics of C with regard
>> to pretty much anything.
>
>Not at all. For example, I do not have to rely on the semantics of
>trigraphs, since I avoid them like the plague.

You may still inadvertently fall upon them, if you're not extremely
careful. E.g.

    puts("Huh??!");

This is more of an issue when automatically encoding binary data in
string literals (e.g. using a base64-style algorithm) that are supposed
to be used by C programs. You *must* check that you're not inadvertently
inserting a trigraph sequence in that string literal.

See, their semantics are haunting even the trigraph haters...

Dan

-- 
Dan Pop
DESY Zeuthen, RZ group
Email: Dan.Pop@ifh.de


Relevant Pages

  • Re: Theodore Adorno, a prophet of data systems design
    ... >) the VB For loop DESPITE the fact that informal proofs are simpler for ... For the Basic semantics, you need an extra step (which technically ... >) We've read the charter, and it doesn't support your reading of the ... > A lot of your comments have nothing to do with programming whatsoever. ...
    (comp.programming)
  • Re: About context sensitivity.
    ... languages can have classes that respond differently to different situations. ... VB.NET is very much about event-driven programming. ... > semantics I mean a function of class reads some sort of Meta Data and ... in the context of that. ...
    (microsoft.public.dotnet.framework.clr)
  • Re: Python from Wise Guys Viewpoint
    ... >> Look at any textbook on programming language semantics. ... I'm familiar with semantics. ... Nonetheless, equations mapping ... > equations are mathematical functions. ...
    (comp.lang.lisp)
  • Re: Swapping
    ... Dan Pop wrote: ... It has the semantics of a variable, ... I was speaking in general terms, ... a pointer x *may* point to a variable. ...
    (comp.lang.c)
  • Re: Swapping
    ... Dan Pop wrote: ... It has the semantics of a variable, ... I was speaking in general terms, ... a pointer x *may* point to a variable. ...
    (comp.lang.cpp)