Skip to contentSkip to conversation

Ambiguities

DISCUSSION Harry Kalogirou 2 participants 4 messages Apr 21, 2002 – Apr 22, 2002

lore
Share & tools
lore
#0 lore raw

Hi Riley,

I noticed in the CHANGELOG that you resolved some ambiguities in the source. As far as I know

X =* Y doen't mean X = X * Y, that is X *= Y. I wonder what are you tring to say?

Harry

#1 lore raw

Hi Harry.

Quoted 3 lines

I noticed in the CHANGELOG that you resolved some ambiguities in the source. As far as I know X =* Y doen't mean X = X * Y, that is X *= Y. I wonder what are you trying to say?

The problem here is an old one - the original K&R C specification allowed the operation assignment combinations to be specified either way round, so the sequences *= and =* *CAN* be regarded as the same. The same is also true of the other operators. I hit this problem at university back in 1996, as the standard C compiler on one of the systems was an old compiler that actually implemented that behaviour, and the standard compilers on the other machines were newer ones that didn't implement it.

Most current C compilers do not implement that aspect of K&R and, as far as I know, bcc is amongst the ones that didn't. However, when indent pointed them out to me, I felt that the safest solution was to simply get rid of the ambiguities in the first place, so I went through the code and did just that. The sequence I used was to do make dup to create a test copy of the source, then do make indent on the test copy to locate the occurrances, and finally to edit the original copy and insert the spaces needed to remove the ambiguities.

Best wishes from Riley.

#2 lore raw

Την Κυρ, 21-04-2002 στις 22:50, ο/η Riley Williams έγραψε:

Quoted 24 lines

Hi Harry.

Quoted 3 lines

I noticed in the CHANGELOG that you resolved some ambiguities in the source. As far as I know X =* Y doen't mean X = X * Y, that is X *= Y. I wonder what are you trying to say?

The problem here is an old one - the original K&R C specification allowed the operation assignment combinations to be specified either way round, so the sequences *= and =* *CAN* be regarded as the same. The same is also true of the other operators. I hit this problem at university back in 1996, as the standard C compiler on one of the systems was an old compiler that actually implemented that behaviour, and the standard compilers on the other machines were newer ones that didn't implement it.

Most current C compilers do not implement that aspect of K&R and, as far as I know, bcc is amongst the ones that didn't. However, when indent pointed them out to me, I felt that the safest solution was to simply get rid of the ambiguities in the first place, so I went through the code and did just that. The sequence I used was to do make dup to create a test copy of the source, then do make indent on the test copy to locate the occurrances, and finally to edit the original copy and insert the spaces needed to remove the ambiguities.

Quoted 2 lines

Best wishes from Riley.

Very interesting _feature_... I wonder what was they thinking!!?

Harry

-
To unsubscribe from this list: send the line "unsubscribe linux-8086" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

Hi Harry.

Quoted 23 lines
Quoted 13 lines
Quoted 3 lines

I noticed in the CHANGELOG that you resolved some ambiguities in the source. As far as I know X =* Y doen't mean X = X * Y, that is X *= Y. I wonder what are you trying to say?

The problem here is an old one - the original K&R C specification allowed the operation assignment combinations to be specified either way round, so the sequences *= and =* *CAN* be regarded as the same. The same is also true of the other operators. I hit this problem at university back in 1996, as the standard C compiler on one of the systems was an old compiler that actually implemented that behaviour, and the standard compilers on the other machines were newer ones that didn't implement it.

Quoted 9 lines

Most current C compilers do not implement that aspect of K&R and, as far as I know, bcc is amongst the ones that didn't. However, when indent pointed them out to me, I felt that the safest solution was to simply get rid of the ambiguities in the first place, so I went through the code and did just that. The sequence I used was to do make dup to create a test copy of the source, then do make indent on the test copy to locate the occurrances, and finally to edit the original copy and insert the spaces needed to remove the ambiguities.

Quoted 1 line

Very interesting _feature_... I wonder what was they thinking!!?

I can assure you that when the problem originally came to light, many rather "colourful" words were uttered by the University staff. It came to light TWO DAYS before the mid-term practical exams, and those exams had to be postponed to allow time for ALL of the compilers on ALL of the University's servers to be audited to ensure that the same version of each compiler was in use throughout the university, and that this was the latest practical version of that compiler. This affected some 7,300 students spread across 17 different degree level courses, both at Bachelor and Master degree level...

Best wishes from Riley.