 | Discussion Forum |  |
|
|
compilre does not complain of "," instead of ";"Next Thread | Thread List | Previous Thread Start a Thread | Settings | Details | Message |
|---|
Read-Only Author adalgiso castrignano castrignano Posted 24-Oct-2007 08:53 GMT Toolset C51 |  compilre does not complain of "," instead of ";" adalgiso castrignano castrignano Hi I have the following code static bit cc_0 = 0; ...... if ((!CC_GDO_0 && cc_0) == 0) return 0; cc_0 = 0, // here I have a , instead of ; temp = SpiReadStatus(CCxxx0_MARCSTATE); ..... I am surprise that the compiler does not generate or warn me of the comma error? I have version 87.08 of C51. | | Read-Only Author Christoph Franck Posted 24-Oct-2007 09:07 GMT Toolset C51 |  RE: compilre does not complain of "," instead of ";" Christoph Franck I am surprise that the compiler does not generate or warn me of the comma error? The compiler is correct. A comma is a sequential evaluation operator in C, which allows putting several operations in places where only one would be allowed, for example
for(i = 0, j = 0; i < 10; i++)
It is also perfectly valid, though somewhat pointless, to use this operator in normal expressions. | | Read-Only Author Per Westermark Posted 24-Oct-2007 09:29 GMT Toolset C51 |  RE: compilre does not complain of "," instead of ";" Per Westermark Onless the normal expressions has operations with side effects. | | Read-Only Author Andy Neil Posted 24-Oct-2007 09:49 GMT Toolset None |  More on the Comma Operator... Andy Neil http://www.keil.com/forum/docs/thread6339.asp http://www.keil.com/forum/docs/thread10451.asp | | Read-Only Author Silly Sausage Posted 24-Oct-2007 10:24 GMT Toolset None |  I'm well out of date Silly Sausage "I have version 87.08 of C51" I'd better do an update. There might be a few differences between this version and the lowly one I'm using ;) | | Read-Only Author Andy Neil Posted 24-Oct-2007 10:40 GMT Toolset None |  RE: I'm well out of date Andy Neil "I have version 87.08 of C51" Wow! Can I borrow your Time Machine...? | |
Next Thread | Thread List | Previous Thread Start a Thread | Settings |
|