I recently read that .h is reserved for C standard library headers, and all user headers should have a .H in order to distinguish themselves. Is this actually something that is considered a standard convention?
I recently read that .h is reserved for C standard library headers, and all user headers should have a .H in order to distinguish themselves. Is this actually something that is considered a standard convention?
i dont think so... i have been programming in C for the past few years and have always used a ".h" as a header extension.
Standard C headers are distinguished from user header files in the way they are incuded in a program
#include <stdio.h>
#include "userheader.h"
Note the "<" and ">" for standard headers and quotes for user headers.
If you save your "userheader.h" in the includes directory, you can
Code:#include <userheader.h>
Operating Systems:
- Ubuntu 9.04
- XP
Compiler: gcc
> If you save your "userheader.h" in the includes directory, you can
Bad idea - there is no standard for naming header files, so you could lose everything when you next update the compiler.
For all practical purposes, the system include directories should be regarded as read-only.
If you have your own header of useful tools, then there is no problem creating your own user include directory, adding that to the compiler search path, and doing
#include <userheader.h>
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.
But don't expect that approach to be portable!
C is a very nice guy; he doesn't really care what you use. You can "#include <madfile.abc>" if you wanted to. That ".H" thing is probably just some misguided suggestion you picked up from somewhere. I have never seen any header files explicitly using that kind of extension.
Besides, on Windows, ".h" and ".H" pretty much mean the same thing
Code:#include <stdio.h> void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){ puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9 /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i] ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][ t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}