This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: right-hand operand of comma has no effect


On Mon, 27 Feb 2006, Mary Cuper wrote:

> I want to set the baudrate of my /dev/ttyS0 with:
>
> cfsetispeed(&options, B9600);
> cfsetospeed(&options, B9600);
>
> but always get:
>
> "Warning: right-hand operand of comma has no effect".
>
> With linux the code functions!

Cygwin uses newlib, which defines cfsetospeed as a macro that expands to
(foo, 0).  "foo" is the part that does the actual work.  g++ is simply
warning you that the "0" has no effect in void context (since you're
throwing away the return code).  Linux uses glibc, which defines
cfsetospeed as a real function.

You can safely ignore this warning.  If you want to get rid of it, cast
the return value to void, i.e.,

(void)cfsetospeed(&options, B9600);

or use the result in some expression.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]