Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

comparing floating point types in generator equality operator #301

Open
JSG-0 opened this issue Feb 15, 2024 · 0 comments
Open

comparing floating point types in generator equality operator #301

JSG-0 opened this issue Feb 15, 2024 · 0 comments

Comments

@JSG-0
Copy link

JSG-0 commented Feb 15, 2024

here is my dataArray.idl contents:

struct dataPair
	{
	float	real;
	float	img;
	};

struct dataArray
	{
	dataPair		dataPairs[64];
	};

Code generated using fastddsgen version 3.0.1 :
fastddsgen -cs -ppDisable -replace dataArray.idl

Compiling on Ubuntu 20.04 with gcc-13.3.0 with the flag -Wfloat-equal catches these errors:
dataArray.cxx:85:20: error: comparing floating-point with '==' or '!=' is unsafe
dataArray.cxx:86:18: error: comparing floating-point with '==' or '!=' is unsafe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant