[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sv: Sv: Sv: Sv: PenguinFile



Looking through my old Email before deleting it, it occured to me that I
haven't yet answered this Email.

>> It should ATLEAST give a warning, then. I don't see why a compiler should
>> assist someone in writing incorrect code, even if it comes out the same.
>>
>> char* pThisIsAString = "whatever";
>> WriteToDisk(pThisIsAString);
>> WriteToDisk(pThisIsaString);
>>
>> Should this compile? I would consider it a bug if it did...
>>
>Why shouldnīt it? pThisIsAString is a completely valid C-style string.
>And, depending on the implementation, you eventually *can* modify it.
>
Actually there are two bugs on those two lines. pThisIsAString is an unconst
pointer, but "whatever" yields a const pointer. In the third line,
pThisIsAString is spelled with the wrong case for the a.

My point was that if a compiler was clever enough, it should also be able to
figure out that that was a case error and find out what variable that it was
supposed to pass to the second call of WriteToDisk(). This is of course not
a very cool "feature" for a compiler to have.

>> Reminds me of when Microsoft first said that each program would be given
>> it's own memory, and other programs couldn't read or write to this memory
in
>> MS's new OS. But later, people found out something that was quite clearly
a
>> bug that allowed both reading and writing to other processes' memory. Do
you
>> know what Microsoft called it? a "feature" :)
>>
>But thatīs really a different problem that the const thing - in fact the
>const thing IMHO really is no problem at all. Itīs perhaps a bit sloppy
>written, but thatīs it.
>
It makes it impossible to utilise any of the benefits of using const. I
wouldn't be able to use a compiler that did something like that.


>>>Byte order. if you have some integer, say 123456789 (hex 75BCD15),

>>>
>> Sometimes you REALLY wonder why people couldn't just have agreed on this
>> from the start, don't you? I mean, something as stupid as this DOESN'T
>>
>Well, which one would you have chosen? They are completely equal...
>
I would have chosen whatever everybody else used.

>>>>had to delete the linux partitions and install linux again. It's working
>>>>now, but it still can't mount the swapdrive... btw, how do you get to
the
>>>
>>>Did you set up one?
>>>
>>Sure did, all 400 megs of it - I know that's way to large, but diskdruid
>>
>... and thatīs the problem. swap partitions may not be larger than 127M
>(donīt ask me why).
>
Hmm... Reinstalled (now with 125 megs of swap). It booted fine a few times,
now it complains that it "can't create initial consol" and stops, compeltely
unresponsive to anything. You can't even restart. I'm getting a bit annoyed
at Red Hat...