Sponsored Content
Full Discussion: enum and C preprocessor
Top Forums Programming enum and C preprocessor Post 302556464 by Corona688 on Sunday 18th of September 2011 03:58:14 PM
Old 09-18-2011
Quote:
Originally Posted by agama
An enum is interpreted by the compiler and not the preprocessor.
That explains it.

Okay, redone with #define's and it works. Ordinarily I'd avoid preprocessor tricks, except PIN_A defines a value that's used in both preprocessor and expression contexts -- it can be used as an integer like (1<<PIN_A), to define an 8-bit number to be fed into PORTA, or as part of a variable name RA[0-9] to define a member of a bitfield...
 

8 More Discussions You Might Find Interesting

1. Programming

what is the base type of enum

helo i have asked in exam what that what is the base type of enum options are given bewlo (1) long int (2) short int (3) signed int (4) unsigned int can u tell me what is the exact answer from the above option Regards, Amit (1 Reply)
Discussion started by: amitpansuria
1 Replies

2. IP Networking

DNS ENUM RR interpretation

Hi Guys, This is really really urgent. Am looking out for some quick answers. I'm developing a DNS Resolver client that interprets DNS Query repsonses & pass on the needful to DNS applications. When an ENUM query(modified to an nslookup naptr query) is issued & an NAPTR RR(Resource Record)... (1 Reply)
Discussion started by: smanu
1 Replies

3. Programming

Preprocessor

Hi, Anyone please explain the functionality of ## in c. I didn't get the following preprocessor directives, # define LL(x) x ## LL # define LL(x) x ## i64 Thanks, Naga:cool: (1 Reply)
Discussion started by: Nagapandi
1 Replies

4. Programming

enum in c++

#include <iostream> #include <stdio.h> using namespace std; typedef struct A { enum a{ red,blue,green}a; }obj11; obj11 obj1; int main() { //obj1.a=red; // how to set variable ? cout<<"sizeof struct is n"<<sizeof(obj1); cout<<"obj1.a is"<<obj1.a; if... (1 Reply)
Discussion started by: crackthehit007
1 Replies

5. Programming

Preprocessor __FILE__ for Debugging

Hi, Just wondering if it is possible to trim the file path output by __FILE__ preprocessor in my debugging line. Let's say my main.cpp file is found in C:\User\MyName\SystemA\Mod1\SubMod2\Test\main.cpp for __FILE__, I just want the filename - main.cpp to be printed, instead of the entire... (2 Replies)
Discussion started by: tanlccc
2 Replies

6. Programming

C- trying to code a 'spare array'; 'enum' fauled.

I am trying to implement a spare array in C that would be referenced by regular integers. Right away: define array for maximum possible index elements completely is not what I trying to get!!! It should be a construction that would have just 2 elements if I need to have just two indexes, like... (8 Replies)
Discussion started by: alex_5161
8 Replies

7. Programming

Mixed enum types - coverity defect

Hi All, I came across this error "MIXING ENUM TYPES" when I run my C program against the Coverity Tool. I've made many search relating to the error, but I didnt find the exact solution. Can anyone help me to overcome this.? Thanks in Advance.!! (3 Replies)
Discussion started by: Parameswaran
3 Replies

8. Programming

Use #if not defined with OR boolean logic in preprocessor directives

I am currently using Linux CentOS and programming in FORTRAN 90 using Portland 7.1 compiler. I am able to set in the preprocessor directives a flag called TEST. when I go to use logic in my code i can write #ifdef TEST execute something #endif Furthermore, if I want to negate the... (2 Replies)
Discussion started by: prodigious8
2 Replies
ic(1int)																  ic(1int)

Name
       ic - compiler for language support database

Syntax
       ic [ -Dname=def ] [ -Uname ] [ -Idir ] [ -v ] [ -o output ] [ source ]

Description
       The  command  generates a binary international database from a database language source file. The command either accepts its input from the
       file source or from the standard input, if you do not specify source .

       The name of the output file is the name of the codeset in the source file or the name you specify using the option.

       For information on creating a database language source file, see the Guide to Developing International Software.

Options
       -D   Defines name to the C preprocessor.  This option has the same effect as including the directive at the head of your source	file.  The
	    default name definition is 1.

       -U   Removes any initial preprocessor definition of name .

       -I   Causes the compiler to search the named directory for files you name in an directive.

       -o   Specifies  the  name you want to use for the output file.  By default, the compiler uses the name of the codeset in the source file to
	    name the output file.

       -v   Requests statistics on the number of simple and double letters in the source file, the number of tables in the source  file,  and  the
	    size of the output binary file.

Restrictions
       The length of the table name modifier is limited to 44 characters.

Examples
       The following command causes the compiler to compile the source file:
       % ic -v GER_CH.8859.in
       INTLINFO database GER_CH.8859:
	     257 code table entries (256 simple/1 multi-byte).
	       1 property table(s).
	       1 collation table(s).
	       1 string table(s).
	       3 conversion tables: toascii, tolower, toupper.
       5051 bytes total length.
       The  compiler  searches	for  the file in the current working directory.  The compiler writes compilation statistics to as requested by the
       option.	The compiler creates a binary file, named in the current working directory.

Return Values
       The compiler returns zero exit status for successful compilation; it returns nonzero status if it encounters errors that inhibit generation
       of a binary file.

Diagnostics
       The compiler issues four types of messages.  The following list describes each of the four types:

       warning	      The compiler has detected syntax that may be in error, but does not adversely effect the binary file.

       error nn       The compiler has detected an error severe enough to inhibit the generation of a correct binary file.

       fatal error    The  compiler  has detected an error that makes it impossible to proceed with the compilation.  This error most often occurs
		      during compilation of the code table.

       fatal bug      This occurs when there are internal errors in the compiler.  For example, this is generally produced  when  an  incompatible
		      source file is given as an input to

Files
       Temporary files

       C preprocessor

See Also
       intro(3int), setlocale(3), environ(5int), lang(5int), nl_langinfo(5int)
       Guide to Developing International Software

																	  ic(1int)
All times are GMT -4. The time now is 01:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy