delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/04/19/07:08:16

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:to:from:subject:date:message-id:mime-version
:content-type:content-transfer-encoding; q=dns; s=default; b=EvM
Nj0FLaQ7pSy40DTzcFCxx3KHvNHgqaRxl4C2FYEVi2qaxKgAR4LpJbjFv16sCDP5
/3qIHCozD8FcOqfi51rM2+4bIXWcE9HvjeA+Sv+R3vQ2JiSMONS4dbYi2lkRt/dQ
lceG7RIqKjJIE4IgYk3GxBPuH2bentPxbDlMSt3s=
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:to:from:subject:date:message-id:mime-version
:content-type:content-transfer-encoding; s=default; bh=wpFGppf/U
DWIXt2ZhmKME2YTaUI=; b=XEBC7ZWZrLHrUXJRaLpJFVQSq9acCm3/TKsxYl8DB
ZauC7pkvgQB6Fb4kAeBoMffQPNR5Y7MJQw6Svhp0yZyAR/sKi5pUl3nCVPA9/1OM
eo1DHCXYMI+BVAi0uaeV2w5BhbXGEKWeu+8Pl5CYwJQxLUoKjWdaR9oEPIUFV59Y
Uk=
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=-1.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1
To: cygwin AT cygwin DOT com
From: David <dbj AT vip DOT cybercity DOT dk>
Subject: g++ no warning about uninitialized variables
Date: Fri, 19 Apr 2013 13:07:58 +0200
Lines: 44
Message-ID: <kkr8hl$m7q$1@ger.gmane.org>
Mime-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/17.0 Thunderbird/17.0

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?




--
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