- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello there,
I'd like to have the Compiler warning me for the following things:
uninitialized variables
conversions between different datatypes with possible data loss ( float flTest = 1.2225f; int iTest = flTest; )
How would I go about that ? Is there a specific Switch I will need to set ?
Thanks in advance!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For the first warning on Linux you should use the -Wuninitialized flag and on Windows the diagnostic comes out as a warning by default, i.e.:
!% cat warning.c
int main() {
float flTest = 1.2225f;
int iTest = flTest;
int i;
i++;
return 0;
}
!% icl -c warning.c
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Versi
on Mainline Beta Build x
Built Sep 15 2016 11:01:53 by jward4 on JWARD4-DESK1 in D:/workspaces/cfe/dev
Copyright (C) 1985-2016 Intel Corporation. All rights reserved.
warning.c
warning.c(6): warning #592: variable "i" is used before its value is set
i++;
^
!%
We do not have a diagnostic for the int to float conversion. I will enter a request for that. Linux has a -Wfloat-conversion switch but we don't support that yet. I will submit a request for that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I submitted DPD200415464 in our internal bugs database for a warning on the int to float conversion.
thanks for the suggestion.
Judy

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page