pedantic

How to ignore gcc compiler pedantic errors in external library headers?

I recently added -pedantic and -pedantic-errors to my make gcc compile options to help cleanup my cross platform code. All was fine until it finds errors in external included header files. Is there a way to turn off this error checking in external header files IE: Keep checking for files included like this: #include "myheader.h" Stop...

Is there an equivalent to -pedantic for gcc when using Microsoft's Visual C++ compiler?

I would like to have my warnings set to the highest level using Microsoft Visual C++ compiler. Similar to using -pedantic on gcc. What compiler switches do you use to have the most warnings enabled? ...

C: how can I fix warnings like: "comparison between signed and unsigned"

I have been advised to use the following options with GCC, as it helps to avoid a lot of common errors. It turns on a bunch of warnings and -Werror turns them into errors. gcc -pedantic -W -Wall -Wextra -Wshadow -Wstrict-overflow=5 -Wwrite-strings -std=c99 -Werror Given the following test code: #include <stdio.h> int main(void) { ...

GCC: Is it possible to disable the "comma at end of enumerator list" warning when using -pedantic?

Hello, I'm compiling C++ code and I'd like to enable the -pedantic option. I'm using GCC 4.0, running Xcode on Mac OS X Leopard. It is for example possible to allow variadic macros and the long long type that are normally forbidden when using -pedantic (with -Wno-variadic-macros and -Wno-long-long). But I could not find anything to disa...

Does "if ([bool] == true)" require one more step than "if ([bool])"?

This is a purely pedantic question, to sate my own curiosity. I tend to go with the latter option in the question (so: if (boolCheck) { ... }), while a coworker always writes the former (if (boolCheck == true) { ... }). I always kind of teased him about it, and he always explained it as an old habit from when he was first starting progr...

How to deal with -Wconversion warnings from GCC?

I'm building my project with GCC's -Wconversion warning flag. (gcc (Debian 4.3.2-1.1) 4.3.2) on a 64bit GNU/Linux OS/Hardware. I'm finding it useful in identifying where I've mixed types or lost clarity as to which types should be used. It's not so helpful in most of the other situations which activate it's warnings and I'm asking how a...

Why can't I use //-style comments in my C code?

I am using gcc (Unbuntu 4.4.1-4unbuntu9) to compile a program that I'm writing, but it seems to vomit whenever it sees a // comment in my code, saying: interface.c :##: error: expected expression before â/â token Does the gcc compile mode I'm using forbid // comments? $ gcc -g -ansi -pedantic interface.c structs.h -c -I. -I/home/me/pr...

Do Destructors Have Names According To The Standard?

Do class destructors have names in the pedantic sense according to the Standard? Recall that constructors explicitly do not have names: 12.1.1 : Constructors do not have names. A special declarator syntax using an optional sequence of function-specifiers (7.1.2) followed by the constructor’s class name followed by a param...

Is it possible to add -pedantic to GCC command line, yet have it not warn about 'long long'

I'm using mostly GCC to develop my library, but I'd like to ensure cross-compiler compatibility and especially standard conformance as much as possible. For this, I have add several -W... flags to command line. I'd also add -pedantic, but I have a problem with its warning about long long type. The latter is important for my library an...

What does "powerful" mean, when discussing programming languages?

In the context of programming language discussion/comparison, what does the term "power" mean? Does it have a well defined meaning? Even a poorly defined meaning? Say if someone says "language X is more powerful than language Y" or asks the same as a question, what do they mean - or what information are they trying to find out? ...

Is a node in a tree considered its own ancestor?

I'm wondering what the consensus is on the definition of "ancestor" in a computer science context. I only ask because in Introduction to Algorithms, Second Edition, p. 259 there is a description of the algorithm Tree-Successor(x) that seems odd. In finding the successor of node x, [...] if the right subtree of node x is empty and x ...

CSS pseudo-class vs. pseudo-selector

This is a bit of a pedantic question, but perhaps worth asking. Is there, mechanically, a difference between a pseudo-class and a pseudo-selector in CSS? We use the term interchangeably around here, but it seems that there's a reason for the two terms. Is there any use to differentiating the two? Thanks, Joe ...

What does this compiler warning generated by `-pedantic` mean?

What does this GCC warning mean? cpfs.c:232:33: warning: ISO C99 requires rest arguments to be used The relevant lines are: __attribute__((format(printf, 2, 3))) static void cpfs_log(log_t level, char const *fmt, ...); #define log_debug(fmt, ...) cpfs_log(DEBUG, fmt, ##__VA_ARGS__) log_debug("Resetting bitmap"); The last line bei...

Pedantic: What Is A Source File? What Is A Header? (Not A Newbie Question)

...

Spelling -- hotfix, hot-fix, hot fix ...

It's not directly programming related, admittedly, but at some point most software's has bugs that need to be fixed "now. Really now. No it can't wait." And a debate's opened up internally on exactly how hotfix/hot-fix/hot fix should be spelt: i.e., two words, one word, hyphenated. Googling around there doesnt' seem to be any consisten...

How to do portable 64 bit arithmetic, without compiler warnings.

I occasionally use 64 bit arithmetic in an open source C++ library of mine. I discovered that long long serves my purpose quite nicely. Even some 10 year old solaris box could compile it. And it works without messing around with #defines on Windows too. Now the issue is I get complaints from my users because they compile with GCC -pedan...