Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a subset of C can write like this: i=+1?

Tags:

c

I remember reading a book talking about standard the C programming language. It said in some kinda C you can write i=+1 which equals i+=1. So i(operator)=(expression) equals i=(operator)(expression). I never see this kind of C, is there someone who can explain this?

Best regards and thanks, Fan

like image 300
C.C. Avatar asked Jan 06 '10 16:01

C.C.


2 Answers

That was the very very inital syntax for the += operator in C. I think it was deprecated even before the first edition of K&R book.

EDIT: A PDF with the C Reference manaual can be found here: http://www.math.utah.edu/computing/compilers/c/Ritchie-CReferenceManual.pdf look at 7.14.1

(Alas, the one posted by AnT is no longer valid)

like image 105
Remo.D Avatar answered Nov 14 '22 03:11

Remo.D


This is true. That version of C is called CRM C (CRM stands for "C Reference Manual" - a document written by Dennis Ritchie). There are many weird things in that version of C.

You can download the document here http://cm.bell-labs.com/cm/cs/who/dmr/cman.pdf

like image 21
AnT Avatar answered Nov 14 '22 04:11

AnT