Re: deprecated conversion from string constant to 'char*'
Re: deprecated conversion from string constant to 'char*'
- Subject: Re: deprecated conversion from string constant to 'char*'
- From: Jeffrey Walton <email@hidden>
- Date: Thu, 02 May 2013 13:45:54 -0400
On Thu, May 2, 2013 at 1:23 PM, Gerd Knops <email@hidden> wrote:
> Recently iOS Dev Weekly linked to a pretty decent article about warnings:
>
> http://oleb.net/blog/2013/04/compiler-warnings-for-objective-c-developers/?utm_source=iOS+Dev+Weekly&utm_campaign=25515b4b70-iOS_Dev_Weekly_Issue_91&utm_medium=email
>
> I arrived at using -Wall -Wextra -Wno-unused-parameter (and may throw in
> -Wno-sign-compare for legacy projects).
-Wsign-conversion is important to catch C/C++/Obj C promotions, where
-1 > 1 after promotion. This happens because a signed int is promoted
to an unsigned int when mixing the data types. You might consider it
for all projects.
-Wstrict-overflow? That warns of optimizations taken due to illegal
code. That is, if something leads to undefined behavior (*not*
implementation defined), the compiler just removes it. For example,
signed integer overflow is undefined and removed (Intel's ICC is
especially aggressive). Unsigned integer wrap is implementation
defined and left in place. See, for example
http://www.airs.com/blog/archives/120.
-Wcast-align? Both x86/x64 and ARM processors fixup misaligned data at
a cost (sometimes its expensive). Earlier ARM processors (ARM4 and
possibly AR5 (I don't recall the cutoff)) simply SIGBUS on you. See,
for example, http://www.gnu.org/software/gsl/manual/html_node/GCC-warning-options-for-numerical-programs.html
(it shows up in an odd place).
-Weverything is noisy, but I would *not* patently recommend not using
it as Begemann in the article. If you use it, you need to learn to
separate the wheat from the chaff with -Wno-XXX.
There's lots more *really* good warnings out there. There are lots of
other goodies available for this stage in the development process. The
trick is you have to ask for them.
https://www.owasp.org/index.php/C-Based_Toolchain_Hardening.
Jeff
> On May 2, 2013, at 11:55 AM, Jens Alfke <email@hidden> wrote:
>
>
> On May 2, 2013, at 9:39 AM, Sean McBride <email@hidden> wrote:
>
> Xcode doesn't have checkboxes for every warning, you sometimes have to add
> extra warning flags in the 'other c flags' setting. If you're using clang,
> I'm a fan of specifying "-Weverything" (which is literrally everything, and
> too much), and then disabling warnings you don't want by appending, for
> example, -Wno-foobar.
>
>
> I'm a bit less aggressive, I just add "-Wall", which is less pedantic than
> "everything" mode but seems to include pretty much all the warnings I need.
>
> I've always wondered why there isn't a checkbox for this in the build
> settings...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden