January 03, 2006
Chris Sauls cited:

[...]
> # typedef int myint;
> # int i;
> # myint m;
> # i = m;             // OK
> # m = i;             // error
> # m = cast(myint)i;  // OK
[...]

Thank you for that clarification.

1) The first assignment shows the case where a variable of a typedef'd type is assigned to a variable of the base type of the typedef ...

... while I was reasoning over assignments to "any other type than its base type".


2) The second assignment shows the case where a variable of the base type is assigned to a variable of a typedef'd type ...

... and according to the comment it is erroneous. This can happen only if the LHS of the assignment is _not_ converted to its base type. This again can only happen if the rules for "Usual Arithmetic Conversions" do _not_ apply.


3) The third assignment shows the case 2) again but with the addition of a `cast' to the typedef'd type with the comment, that this OK. The `cast' would be superfluous if the rules for "Usual Arithmetic Conversions" would apply ... as shown in case 2).


From facts 2) and 3) follows already that the rules stated under "Usual Arithmetic Conversions" do _not_ apply to assignments.



Further thinking that the examples above are special cases would lead to

code:
typedef int myint;
myint a,b,c;
a= b + c; // error, because `b + c' is converted to `int'


Therefore the rules stated under "Usual Arithmetic Conversions" are incomplete. At least rule 1) must be reformulated.

For example:

1. If at least one operand is typedef'd then
   1. if it is the same typedef, no more conversions are done
   2. any typedef on the left of an assignment remains unconverted
   3. all remaining typedef's are converted to their underlying
      type.

Note, that 1.2) may be placed wrongly in this section of the docs because in general the assignment is not an numeric or arithmetic operator.

-manfred

( x-post and f'up to D.bugs)
January 03, 2006
No need to be so aggravated.  It's an easy mistake to make, and after
all, this is the D.learn newsgroup.
Manfred Nowak <svv1999@hotmail.com> wrote:
>Grzegorz Adam Hankiewicz wrote:
>
>[...]
>> I didn't find any warning switches
>> on dmd's command line help to turn on verbosity about such
>> obvious conversion mistakes.
>[...]
>
>Maybe you were too embarressed to see the "-w" warning switch on the command line help.
>
>Maybe you have not read http://www.digitalmars.com/d/warnings.html.
>
>But if you have a C background as your comparison with t_time suggests you should know the implicit conversion rules obeyed by C and that therefore assigning to a variable may cause loss of data, if the type of the variable is not known exactly to you.
>
>It depends on your habits of handlinmg risks what to do in case of unsureness.
>
>You decided to take a risk, lost and now critisizes D.
>
>You could have stated your prerequisite by inserting code like
>  assert( typeof(getUTCtime()).sizeof<= int.sizeof);
>and would have been on the warned side forever.
>
>-manfred
>
>
> 



-- 
Email works.

January 03, 2006
Manfred Nowak <svv1999@hotmail.com> wrote:
>Derek Parnell wrote:
>
>[...]
>> uses the word "arithmetic" when it  really just means "numeric".
>
>Changing the wording would not help much. Please see my answer to "Chris Sauls" posting.
>
>-manfred

You are the one who is sorely mistaken. and you don't need to be so
angsty.
If d_time is a typedef of long, and long can be converted to an int.
Then there's no reason a d_time can't be converted to a long and then to
an int.
The point of a typedef is keeping other stuff out of your typedefs, not
keeping your typedefs out of other stuff.
ÀComprende?

-- 
Email works.

January 03, 2006
S. Chancellor wrote:

> No need to be so aggravated.  It's an easy mistake to make, and after all, this is the D.learn newsgroup.

Same to you. Ever heard of the drama triangle?

-manfred
January 03, 2006
S. Chancellor wrote:

[...]
> The point of a typedef is keeping other stuff out of your typedefs, not keeping your typedefs out of other stuff. ÀComprende?

Me parece chino.
The rules do not demand to convert my typedefs into other stuff on
arithmetics?

-manfred

P.S.: If you want to take over censorship for my postings I will be glad to have them polished by you.

January 04, 2006
Manfred Nowak <svv1999@hotmail.com> wrote:
>S. Chancellor wrote:
>
>> No need to be so aggravated.  It's an easy mistake to make, and after all, this is the D.learn newsgroup.
>
>Same to you. Ever heard of the drama triangle?
>
>-manfred

Ever heard "If you can't say something nice, don't say anything at all?"
  If you don't like stupid questions, don't answer them.
-- 
Email works.

January 04, 2006
S. Chancellor wrote:

[...]
> Ever heard "If you can't say something nice, don't say anything
> at all?"
>   If you don't like stupid questions, don't answer them.

Okay. I see, that the climate of the D-NG has changed drastically. Instead of polishing up my posts you want me to say nothing.

Thats the second time that someone reacts this way to my incapabilities stemming from the fact not to be a native english speaker.

I leave the D-community now. Please inform Walter to nominate some other co-editor.

-manfred
January 04, 2006
Manfred Nowak wrote:
> S. Chancellor wrote:
> 
> [...]
>> Ever heard "If you can't say something nice, don't say anything
>> at all?"   If you don't like stupid questions, don't answer them.
> 
> Okay. I see, that the climate of the D-NG has changed drastically. Instead of polishing up my posts you want me to say nothing.
> 
> Thats the second time that someone reacts this way to my incapabilities stemming from the fact not to be a native english speaker.
> 
> I leave the D-community now. Please inform Walter to nominate some other co-editor. 
> 
> -manfred

Manfred, you can't use the English-is-a-second-language excuse anymore.  Your posts are quite purposeful in your disdain for people or their posts.  You seem to have enough of a handle of English to fully understand the points you are getting across.

In fact, maybe you are just being a little too cocky with your handle of English.  It's like taking a big knife in your hand and deftly twirling it on your fingertips... only to discover that you lack the coordination for the maneuver; in short, it's dangerous, and the way you've been "twirling" your English around is bound to hurt you and others.

You could easily avoid this by writing plain and straight English and avoid all attempts at English idiom, sarcasm, or wit.  You just can't do it.  I've been completely perplexed at some of your posts.  You have been your own worst enemy.  Maybe I shouldn't have addressed you directly like this.  I'm sorry if this offends you, but I believe it needed to be said.

-JJR
January 04, 2006
Manfred Nowak says...
>
>S. Chancellor wrote:
>
>[...]
>> The point of a typedef is keeping other stuff out of your typedefs, not keeping your typedefs out of other stuff. ÀComprende?
>
>Me parece chino.

Manfred,

you made a mistake on the Spanish statement above.  It should had been, "me pareces chino."

Just clearing things up. :-)

josé

PS: Sorry, I had to do it. :-)


January 05, 2006
jicman escribió:
> Manfred Nowak says...
> 
>>S. Chancellor wrote:
>>
>>[...]
>>
>>>The point of a typedef is keeping other stuff out of your
>>>typedefs, not keeping your typedefs out of other stuff.
>>>ÀComprende?
>>
>>Me parece chino.
> 
> 
> Manfred,
> 
> you made a mistake on the Spanish statement above.  It should had been, "me
> pareces chino."

Yo pensaba que se refería a lo que S. Chancellor escribió, no a él mismo. A mí me pareció correcto.

For those lost in translation: Manfred wrote "it seems chinese to me". José argues that it should've been "you seem chinese to me", which I think is not what Manfred tried to say.

> 
> Just clearing things up. :-)
> 
> josé
> 
> PS: Sorry, I had to do it. :-)
> 
> 

Same here :P


-- 
Carlos Santander Bernal