delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/04/20/02:47:13

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=Cm2KTrfym5eHCA1uG/YRYBOZNe3f/iKQkWfnur2AWYG
uPnlq8AXdaaw63HRd4lglMjzsHqxj/PN6l9JHJD4ATzhcr3Ukkj8TOwRaneN1tRr
BxCvn4IGrrDNh2G2bKiXUoECduuFfj6X/tcbGfd9oh7ttkfikgi/KBcIyu4FpLR4
=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=Zhk2Ui/OKmnb6y9VSM3P4LLhOMc=; b=QwyhNDDQm5xOe7sc8
CecaGHnA3gXI2fYU9o08eqIVUg6AiuUkiJf8cmUmP0EBUx+YJ8xa7UDhxfFRvLZf
/QPXC5HvxLj9i/kv+OQHvLBRdI35xAd1Pqk2WwYdqlYz4/vE8nO+0HGz1k2WjF7U
Rk1syO2iF2YifpqPuLGS+aeDhY=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Spam-SWARE-Status: No, score=-5.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE autolearn=ham version=3.3.1
X-Received: by 10.194.103.72 with SMTP id fu8mr32112852wjb.42.1366440412101; Fri, 19 Apr 2013 23:46:52 -0700 (PDT)
Message-ID: <517239DA.5080209@gmail.com>
Date: Sat, 20 Apr 2013 08:46:50 +0200
From: marco atzeri <marco DOT atzeri AT gmail DOT com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: g++ no warning about uninitialized variables
References: <kkr8hl$m7q$1 AT ger DOT gmane DOT org>
In-Reply-To: <kkr8hl$m7q$1@ger.gmane.org>

On 4/19/2013 1:07 PM, David wrote:
> I am using eclipse and gnu. (Maybe my version is to old.)
> I have
>
> struct MyStruct {
>    int a0,a1;
> };
>
> void afunc(int &t) {
>    cout<<"in para "<<t<<endl;
>    t=5;
> }
>
> int main() {
>   int a, b,c;
>   MyStruct k;
>   afunc(a);
>   b=c+1;
>   cout<<"b "<<b<<endl;
>   afunc(b);
>   k.a0=k.a1+a;
>   cout<<"k.a0 "<<k.a0;
>   afunc(k.a1);
> }
>
> As you can see a lot of uninitialized variables, but when I compile I
> get no warnings. Here is the result of a compilisation:
>
> **** Build of configuration Debug for project test ****
>
> make all
> Building file: ../src/test.cpp
> Invoking: Cygwin C++ Compiler
> g++ -D_CYGWIN -O0 -g3 -pedantic -Wall -c -fmessage-length=0 -MMD -MP
> -MF"src/test.d" -MT"src/test.d" -o"src/test.o" "../src/test.cpp"
> Finished building: ../src/test.cpp
>
> Building target: test.exe
> Invoking: Cygwin C++ Linker
> g++  -o"test.exe"  ./src/test.o
> Finished building target: test.exe
>
> Why don't I get a warning?
>

likely your makefile is swallowing the output.

g++ -Wall -pedantic prova.cpp -o prova
prova.cpp: In function ‘int main()’:
prova.cpp:18:8: warning: ‘c’ is used uninitialized in this function




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019