Code syntax

Simple code question.
Pound sign on .conf files comments out line so it is not used.
Why is pound sign used for device driver code?
For example:
#include <sys/module.h>

Is this just annotating a header?
 
Just different syntax for different languages. C syntax of #thing is a compiler / preprocessor "directive".

There's no generic .conf syntax, but the special case of /etc/rc.conf, /etc/periodic.conf, and some other similar BSD files comes from sh(1), as they are really just shell scripts which are "sourced" into other shell scripts. It would be bad practice to actually treat them as generic shell scripts, and they should be restricted to the narrow subset of shell syntax described by rc.conf(5), etc. Theoretically, something else on the system could interpret them in the narrow context of just setting variables (perhaps not actually using the shell to parse them).
 
I am attempting to hack together a GPIO driver for SMSC SCH3114 LPC-IO device on an Advatech SBC. Alot of their boards use the SCH3114.

There are no i386 or AMD64 gpio input-output drivers in the source tree. Only Arm, Mips and PowerPC
 
Pound sign on .conf files comments out line so it is not used.
Not everywhere. In ~/.vimrc for example it's a single quote:
Code:
' this is a remark
set ts=2
Different languages can have different syntax. But most of the time it's common to use a hash.

Nevermind I get it. A pound<command> is different than a pound <random comment>
Yeah, it's confusing though, I have to agree. It can lead to interesting bugs too:
Code:
#some text
#include code to fix bug
#some more text
This actually produces an error. This doesn't:
Code:
# some text
# include code to fix bug
# some more text
I have found and fixed "bugs" like that :D
 
Ugh, yeah, that style/syntax. It's a somewhat unholy collision of C, Objective-C, and non-C syntax. It does work though, so just have to be careful with the exact syntax on comments.
 
Back
Top