Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any C preprocessor as an independent program?

I know that C preprocessor exists as part of compiler. But I'm looking for an independent program. Is there any such tool?

like image 598
claws Avatar asked Dec 12 '10 12:12

claws


2 Answers

It's often called cpp. For example, on my Linux box:


CPP(1)                                GNU                               CPP(1)

NAME
       cpp - The C Preprocessor

SYNOPSIS
       cpp [-Dmacro[=defn]...] [-Umacro]
           [-Idir...] [-iquotedir...]
           [-Wwarn...]
           [-M|-MM] [-MG] [-MF filename]
           [-MP] [-MQ target...]
           [-MT target...]
           [-P] [-fno-working-directory]
           [-x language] [-std=standard]
           infile outfile

This particular one is part of gcc and is available for a wide variety of platforms.

like image 119
NPE Avatar answered Oct 01 '22 23:10

NPE


mcpp.

From the homepage:

mcpp is a C/C++ preprocessor with the following features.

  • Implements all of C90, C99 and C++98 specifications.
  • Provides a validation suite to test C/C++ preprocessor's conformance and quality comprehensively. When this validation suite is applied, mcpp distinguishes itself among many existing preprocessors.
  • Has plentiful and on-target diagnostics to check all the preprocessing problems such as latent bug or lack of portability in source code.
  • Has #pragma directives to output debugging information.
  • Is portable and has been ported to many compiler-systems, including GCC and Visual C++, on UNIX-like systems and Windows.
  • Has various behavior modes.
  • Can be built either as a compiler-specific preprocessor to replace the resident preprocessor of a particular compiler system, or as a compiler-independent command, or >even as a subroutine called from some other main program.
  • Provides comprehensive documents both in Japanese and in English.
  • Is an open source software released under BSD-style-license.
like image 30
knarf Avatar answered Oct 01 '22 21:10

knarf