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:references :mime-version:content-type:content-transfer-encoding :in-reply-to; q=dns; s=default; b=fddUtAJvuqjFfR4rX5sflwFYUO8zaN PMgUD4M4jPvPPGYDe7gNH/pog/eM0ZgoUbn32mgArA8MFkIZZwwIUziZCjIXzUXq mBIAxTNXGMuEXRopBQ11ZZoM9xJ7giuwL9wyVSkzulBmWgxYyXWGaZuXKkTvS3eX YoyDT+UUYwHzU= 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:references :mime-version:content-type:content-transfer-encoding :in-reply-to; s=default; bh=GvEoWW9Wizm9YBkolRiOu4ti1tQ=; b=xrGq HqI/jms+4ogD8fi/z6h9ZS65WGiIKVEZhNkeI0tJyP/n3cC/C8E4wJi5d7EgUXKR DYEmRrZmvu1ZwEpY+CuDvROsKly5t1pKGP1BjBu1y43DE8TIk1q0AxdtUVcSoqJ1 CyqMYlyJ+QD92EgUfNhUDG+7HKjtyt6eH0yhfZM= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=-2.3 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 To: cygwin AT cygwin DOT com From: David Subject: Re: g++ no warning about uninitialized variables Date: Fri, 19 Apr 2013 13:53:57 +0200 Lines: 54 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: One got to use -O or -O1 as option to g++ -O0 will not do. By the way it is really limited to what extent the compiler can track down uninitialized variables. Den 19-04-2013 13:07, David skrev: > 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=5; > } > > int main() { > int a, b,c; > MyStruct k; > afunc(a); > b=c+1; > cout<<"b "< afunc(b); > k.a0=k.a1+a; > cout<<"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