Sponsored Content
Top Forums Programming gcc: warning: will never be executed Post 302379805 by limmer on Saturday 12th of December 2009 11:03:16 AM
Old 12-12-2009
gcc: warning: will never be executed

I get this gcc warning, but the function works correctly. Any ideas?

Quote:
gcc -std=c99 -pedantic -O3 -Wall -Wunreachable-code a.c
Quote:
a.c:13: warning: will never be executed
Code:
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(void)
{
    char A[50] = "";
    strcat(A, "Hello World!");

    int COUNT = 0;
    while(A[COUNT])
    {
        A[COUNT] = (char)(tolower(A[COUNT]));
        COUNT++;
    }
    puts(A); // output: hello world!
    return 0;
}


Last edited by limmer; 12-12-2009 at 12:09 PM..
 

10 More Discussions You Might Find Interesting

1. Programming

gcc compiler warning

The gcc compiler is giving following error in my code. Can Anyone help, why is this warning popping up. "void format, different type arg (arg 1)" The function's on which warning is given, looks like this: void fprint_stderr_sockarray(int* sockets) { .......... .......... } (2 Replies)
Discussion started by: Ahsan
2 Replies

2. Programming

warning from gcc

I get this error warning. test.c: In function 'main': test.c:5: warning: incompatible implicit declaration of built-in function 'memset' After compiling this code #include <stdio.h> int main() { char pBuffer; memset(pBuffer, 0, 32); return 0; } What seems... (2 Replies)
Discussion started by: sledge76
2 Replies

3. Solaris

which processes executed first

When we login to a solaris terminal then which processes executed first? I beleive that first system profile file and user .profile gets executed. So please let me know what happens exactly. The question may like this that which rocesses arre executed first while loging into unix server? (1 Reply)
Discussion started by: surjyap
1 Replies

4. Solaris

Installing gcc - recieve error message gcc : cannot execute

AIM- Install Oracle 11g on Solaris using VMWare Steps 1.Logged on as root 2.Created subfolders à /usr/local/bin & /usr/local/bin/gcc 3.Downloaded gcc & libiconv & unzipped them on my harddrive & burnt them on CD 4.Copied files from CD to /usr/local/bin/gcc 5.Terminal (root) à pkgadd -d... (8 Replies)
Discussion started by: Ackers
8 Replies

5. Programming

help with gcc warning

I get the following gcc warning. I do not see a double being declared anywhere... how can I fix this? (This code is just an example, I realize that the first if bracket will never be executed.) #include <stdio.h> int main(void) { float A = 0.0; int B = 150; if(B == 0) ... (1 Reply)
Discussion started by: limmer
1 Replies

6. Shell Programming and Scripting

How command is executed

as i have been new to unix can any one can tell,when be type a command on unix shell what processing it goes through before execution of it (1 Reply)
Discussion started by: shashank1311
1 Replies

7. AIX

Script not getting executed via cron but executes when executed manually.

Hi Script not getting executed via cron but executes successfully when executed manually. Please assist cbspsap01(appuser) /app/scripts > cat restart.sh #!/bin/ksh cd /app/bin date >>logfile.out echo "Restart has been started....." >>logfile.out date >>logfile.out initfnsw -y restart... (3 Replies)
Discussion started by: samsungsamsung
3 Replies

8. Shell Programming and Scripting

Command is executed twice

Hi I try to run a command using bash script. The script should now look like this: #!/bin/bash case "$1" in start) sudo su - cispmgm -c "/usr/local/jdk/bin/java -Dworking.dir=/opt/ibm/cisp -Denvironment.target= -Xms512M -Xmx1024M -classpath... (3 Replies)
Discussion started by: nikolai.straess
3 Replies

9. Shell Programming and Scripting

If condition - else is never executed

In the following code snippet, 'if' part is always executed irrespective of whether I enter 'y' or 'n'. I am unable to figure out my mistake even after spending couple of hours. Can someone point out the mistake? Thank you! echo "Do you want to delete?(y/n):" read USERINPUT echo $USERINPUT ... (2 Replies)
Discussion started by: Madhus
2 Replies

10. Shell Programming and Scripting

Script is not getting executed

Hi All, I have written a programme where i need to work in one session but when that session get executed it doesnt execute other programme till I write exit. Below is the script #!/bin/bash echo 'Going to start' exectrusteduser.com sh.com cd /UAT_Logs/CDCI_LOGS/SEEDADM pwd echo... (6 Replies)
Discussion started by: ripudaman.singh
6 Replies
std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >(3)     Library Functions Manual	  std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >(3)

NAME
std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits > - SYNOPSIS
Public Types typedef std::ptrdiff_t difference_type typedef std::forward_iterator_tag iterator_category typedef const value_type * pointer typedef const value_type & reference typedef basic_regex< _Ch_type, _Rx_traits > regex_type" typedef match_results< _Bi_iter > value_type Public Member Functions regex_iterator () regex_iterator (_Bi_iter __a, _Bi_iter __b, const regex_type &__re, regex_constants::match_flag_type __m=regex_constants::match_default) regex_iterator (const regex_iterator &__rhs) bool operator!= (const regex_iterator &__rhs) const value_type & operator* () regex_iterator & operator++ () regex_iterator operator++ (int) const value_type * operator-> () regex_iterator & operator= (const regex_iterator &__rhs) bool operator== (const regex_iterator &__rhs) Detailed Description template<typename _Bi_iter, typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type, typename _Rx_traits = regex_traits<_Ch_type>>class std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits > An iterator adaptor that will provide repeated calls of regex_search over a range until no more matches remain. Definition at line 2204 of file regex.h. Constructor &; Destructor Documentation template<typename _Bi_iter , typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type, typename _Rx_traits = regex_traits<_Ch_type>> std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::regex_iterator () Provides a singular iterator, useful for indicating one-past-the-end of a range. Todo Implement this function. Needs documentation! See http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html template<typename _Bi_iter , typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type, typename _Rx_traits = regex_traits<_Ch_type>> std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::regex_iterator (_Bi_iter__a, _Bi_iter__b, const regex_type &__re, regex_constants::match_flag_type__m = regex_constants::match_default) Constructs a regex_iterator... Parameters: __a [IN] The start of a text range to search. __b [IN] One-past-the-end of the text range to search. __re [IN] The regular expression to match. __m [IN] Policy flags for match rules. Todo Implement this function. Needs documentation! See http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html template<typename _Bi_iter , typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type, typename _Rx_traits = regex_traits<_Ch_type>> std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::regex_iterator (const regex_iterator< _Bi_iter, _Ch_type, _Rx_traits > &__rhs) Copy constructs a regex_iterator. Todo Implement this function. Needs documentation! See http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html Member Function Documentation template<typename _Bi_iter , typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type, typename _Rx_traits = regex_traits<_Ch_type>> bool std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::operator!= (const regex_iterator< _Bi_iter, _Ch_type, _Rx_traits > &__rhs) Todo Implement this function. Needs documentation! See http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html template<typename _Bi_iter , typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type, typename _Rx_traits = regex_traits<_Ch_type>> const value_type& std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::operator* () Todo Implement this function. Needs documentation! See http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html template<typename _Bi_iter , typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type, typename _Rx_traits = regex_traits<_Ch_type>> regex_iterator& std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::operator++ () Todo Implement this function. Needs documentation! See http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html template<typename _Bi_iter , typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type, typename _Rx_traits = regex_traits<_Ch_type>> regex_iterator std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::operator++ (int) Todo Implement this function. Needs documentation! See http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html template<typename _Bi_iter , typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type, typename _Rx_traits = regex_traits<_Ch_type>> const value_type* std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::operator-> () Todo Implement this function. Needs documentation! See http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html template<typename _Bi_iter , typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type, typename _Rx_traits = regex_traits<_Ch_type>> regex_iterator& std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::operator= (const regex_iterator< _Bi_iter, _Ch_type, _Rx_traits > &__rhs) Todo Implement this function. Needs documentation! See http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html template<typename _Bi_iter , typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type, typename _Rx_traits = regex_traits<_Ch_type>> bool std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::operator== (const regex_iterator< _Bi_iter, _Ch_type, _Rx_traits > &__rhs) Todo Implement this function. Needs documentation! See http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html Author Generated automatically by Doxygen for libstdc++ from the source code. libstdc++ Tue Jun 10 2014 std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >(3)
All times are GMT -4. The time now is 01:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy