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?
...
Hi,
By default gcc/g++ prints a warning message with the line number only. I am looking for the option by which g++ or gcc associates the build warning messages with the warning ids, so that the warning messages can be identified easily (without parsing). Also can there be any more option to get a more detailed warning message ? (Th...
Is there a difference between the two examples below for beginning a Perl script? If so, when would I use one over the other?
example 1:
#!/usr/bin/perl
use warnings;
example 2:
#!/usr/bin/perl -w
...
In a coding style question about infinite loops, some people mentioned they prefer the for(;;) style because the while(true) style gives warning messages on MSVC about a conditional expression being constant.
This surprised me greatly, since the use of constant values in conditional expressions is a useful way of avoiding #ifdef hell. F...
I was just writing some quick code and noticed this complier error
Using the iteration variable in a lambda expression may have unexpected results.
Instead, create a local variable within the loop and assign it the value of the iteration variable.
I know what it means and I can easily fix it, not a big deal.
But I was wondering why ...
Here is some simple Perl to count the number of times a value occurs in an array. This runs without any warnings.
use warnings;
use strict;
my @data = qw(1 1 2 3 4 5 5 5 9);
my %histogram;
foreach (@data)
{
$histogram1{$_}++;
}
When the loop body is changed to
$histogram{$_} = $histogram{$_} + 1;
Perl warns "Use of uninitializ...
Hi All,
I am having trouble with a very simple Perl process. I am basically querying an Oracle database and I want to load it into Excel. I have been able to use DBIx::Dump and it works. However, I need to be able to use a variety of Excel formatting tools. And I think Spreadsheet::WriteExcel is the best module that outputs to Excel ...
I wrote a php code like this
$site="http://www.google.com";
$content = file_get_content($site);
echo $content;
but when I remove "http://" from $site I get this warning
Warning:
file_get_contents(www.google.com)
[function.file-get-contents]: failed
to open stream:
i try ( try and Catch ) but it didn't work .
...
I just read this post about why new-line warnings exist, but to be honest my team has people working on several different platforms and with several different editors (everyone uses what bests suites them), so the warning has become ubiquitous, and since its not really a warning worth taking care of it's become Noise and makes finding se...
I need to have a set of overloaded functions in my code but I get convertion wanrings.
Here is a test code:
#include windows.h
void f(DWORD arg){...}
//void f(SIZE_T arg){}
void main(void)
{
DWORD dword=0;
SIZE_T size_t=dword;
f(size_t);
}
The compiler gives warning:
test.cpp(11) : warning C4244: 'argument' : conversion from 'SIZ...
I've got a strange problem with SQL Server 2000, and I just can't think of a reason for this to happen.
There are two tables, both having a combined primary key with a clustered index on it, both keys have the same structure:
(VARCHAR(11), INT, DATETIME) /* can't change this, so don't suggest I should */
So, joining them like this ...
I am getting this warning:
Use of uninitialized value in eval \"string\" at myscript.pl line 57.
When I run this code:
eval;
{
`$client -f $confFile -i $inputFile -o $outputFile`;
};
if( $@ )
{
# error handling here ...
}
What is causing the error?
How can I fix the underlying cause? (Or otherwise suppress the war...
I am working on a C++ project and I noticed that we have a number of warnings about unused parameters.
What effect could it have if these warnings are ignored?
...
The top of my web.xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"
version="2.5">
But I still get the wa...
I'm using Eclipse Ganymede. Everything works fine, but I have an anal-retentive yearning for a warning-free Problems tab. Right now it (correctly) complains about my ant scripts: "No grammar constraints (DTD or XML schema) detected for the document." Any way to turn that off for just those files? Ideally I'd like it to still warn me ...
In the Java snippet:
SyndFeedInput fr = new SyndFeedInput();
SyndFeed sf = fr.build(new XmlReader(myInputStream));
List<SyndEntry> entries = sf.getEntries();
the last line generates the warning
"The expression of type List needs unchecked conversion to conform to List<SyndEntry>"
What's an appropriate way to fix this?
...
In a bunch o' places in my code, I have something like this:
public Class mySpecialMethod() {
return MySpecialClass.class;
}
which causes the warning
Class is a raw type. References to
generic type Class should be
parameterized.
But, if I replace
Class
with
Class<? extends Object>
the warning goes away.
Is this ...
I'm just wondering if there is a quick way to echo undefined variables without getting a warning? (I can change error reporting level but I don't want to.) The smallest I have so far is:
isset($variable)?$variable:''
I dislike this for a few reasons:
It's a bit "wordy" and complex
$variable is repeated
The echoing of a blank string a...
Delphi has a $WARN compiler directive that allows one to selectively enable or disable specific warnings. The Delphi 2009 help file describes the syntax:
{$WARN identifier ON|OFF}
But it only lists the identifiers for 6 warnings.
I'd like to have a complete list of all the warning identifiers. In particular, I want to know the iden...
A colleague of mine recently got bitten badly by writing out of bounds to a static array on the stack (he added an element to it without increasing the array size). Shouldn't the compiler catch this kind of error? The following code compiles cleanly with gcc, even with the -Wall -Wextra options, and yet it is clearly erroneous:
int ma...