-pedantic

This is a discussion on -pedantic within the C Programming forums, part of the General Programming Boards category; I have written this code Code: #include <stdio.h> int main() { unsigned char c; printf("%d\n",c); int i = 2; printf("%d",i); ...

  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    28

    -pedantic

    I have written this code

    Code:
    #include <stdio.h>
    
    int main() {
        unsigned char c;
    
    
        printf("%d\n",c);
        int i = 2;
        printf("%d",i);
        return 0;
    }
    and compiled it with "gcc -ansi -pedantic file.c" but still it is giving only warning but no error for declaring "i" after an action statement. Why ?

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,498
    pedantic increases the number of things to complain about.

    If you want actual errors, then consider
    `-Werror'
    Make all warnings into errors.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pedantic error
    By Hasnat Abul in forum C Programming
    Replies: 2
    Last Post: 10-18-2012, 09:39 PM
  2. gcc -Wall -pedantic
    By flexo87 in forum C Programming
    Replies: 5
    Last Post: 01-26-2009, 01:04 PM
  3. gcc Wall versus pedantic
    By Bajanine in forum C Programming
    Replies: 2
    Last Post: 04-28-2005, 10:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21