Bug 137124 - xosview-1.8.2-5: undefined C code
Summary: xosview-1.8.2-5: undefined C code
Status: RESOLVED FIXED
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: Final
Hardware: All SuSE Linux 10.0
: P5 - None : Minor
Target Milestone: ---
Assignee: Dr. Werner Fink
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-06 11:44 UTC by David Binderman
Modified: 2005-12-13 12:24 UTC (History)
0 users

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2005-12-06 11:44:55 UTC
I just tried to compile package xosview-1.8.2-5 with a
prerelease of the GNU C compiler version 4.1. It said

Xrm.cc:101: warning: operation on "p" may be undefined

The source code is

	while (p && *p)  *p++ = tolower(*p);

I agree with the compiler - this code seems to be undefined.

Suggest new code  

	while (p && *p)
	{
		*p = tolower(*p);
		++p;
	}

BTW, the email address of the author seems to be broken 
[ romberg@md.fsl.noaa.gov ]
Comment 1 Dr. Werner Fink 2005-12-06 12:58:05 UTC
Please explain the difference between

       *p = tolower(*p); ++p;

and

       *p++ = tolower(*p);

... IMO the `++' is only applied after the value
of the current p is changed.  And AFAIK the left
side of the asignment is executed before.
Comment 2 David Binderman 2005-12-06 18:38:19 UTC
>Please explain the difference between

This is a FAQ for C, but I'll have a go anyway

There are no guarantees in C that the left side of
an assignment is evaluated before or after the right side.

The ++ of p on the left side could happen at any time after
the value of p is read for the left side.

This is independent of the read of p on the right side.

More detail is provided in K&R C [ the white book ] or 
Steve Summit's FAQ for C.

Even more detail is provided by doing a web search for 
"sequence points" in ISO C standards documents and the like.

I am happy to answer any further questions. 

Comment 3 Dr. Werner Fink 2005-12-13 12:24:17 UTC
Fixed for next release