Thread: -pedantic

  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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    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.

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, 02:04 PM
  3. gcc Wall versus pedantic
    By Bajanine in forum C Programming
    Replies: 2
    Last Post: 04-28-2005, 10:58 AM