Clang vs GCC (GNU Compiler Collection) URL:


Pro’s of GCC vs clang:

  • GCC supports languages that clang does not aim to, such as Java, Ada, FORTRAN, etc.
  • GCC supports more targets than LLVM.

Pro’s of clang vs GCC:

  • The Clang ASTs and design are intended to be easily understandable by anyone who is familiar with the languages involved and who has a basic understanding of how a compiler works. GCC has a very old codebase which presents a steep learning curve to new developers.
  • Clang is designed as an API from its inception, allowing it to be reused by source analysis tools, refactoring, IDEs (etc) as well as for code generation. GCC is built as a monolithic static compiler, which makes it extremely difficult to use as an API and integrate into other tools. Further, its historic design and current policy makes it difficult to decouple the front-end from the rest of the compiler.
  • Various GCC design decisions make it very difficult to reuse: its build system is difficult to modify, you can’t link multiple targets into one binary, you can’t link multiple front-ends into one binary, it uses a custom garbage collector, uses global variables extensively, is not reentrant or multi-threadable, etc. Clang has none of these problems.
  • For every token, clang tracks information about where it was written and where it was ultimately expanded into if it was involved in a macro. GCC does not track information about macro instantiations when parsing source code. This makes it very difficult for source rewriting tools (e.g. for refactoring) to work in the presence of (even simple) macros.
  • Clang does not implicitly simplify code as it parses it like GCC does. Doing so causes many problems for source analysis tools: as one simple example, if you write “x-x” in your source code, the GCC AST will contain “0”, with no mention of ‘x’. This is extremely bad for a refactoring tool that wants to rename ‘x’.
  • Clang can serialize its AST out to disk and read it back into another program, which is useful for whole program analysis. GCC does not have this. GCC’s PCH mechanism (which is just a dump of the compiler memory image) is related, but is architecturally only able to read the dump back into the exact same executable as the one that produced it (it is not a structured format).
  • Clang is much faster and uses far less memory than GCC.
  • Clang aims to provide extremely clear and concise diagnostics (error and warning messages), and includes support for expressive diagnostics. GCC’s warnings are sometimes acceptable, but are often confusing and it does not support expressive diagnostics. Clang also preserves typedefs in diagnostics consistently, showing macro expansions and many other features.
  • GCC is licensed under the GPL license. clang uses a BSD license, which allows it to be embedded in software that is not GPL-licensed.
  • Clang inherits a number of features from its use of LLVM as a backend, including support for a bytecode representation for intermediate code, pluggable optimizers, link-time optimization support, Just-In-Time compilation, ability to link in multiple code generators, etc.
  • Clang’s support for C++ is more compliant than GCC’s in many ways (e.g. conformant two phase name lookup).

Deployment Node.js no Debian 7 x86-64 bits

Dias atrás, conheci uma galera que está iniciando um startup já um tempo e se deram bem no mundo dos negócios, criando um GW de pagamento baseado em Node.js, então achei legal pesquisar (nos próximos posts falo mais sobre Node.js e suas vantagens):

Para deployment Node.js no Debian 7 x86-64 bits

$ sudo apt-get update && apt-get install git-core curl build-essential openssl libssl-dev

$ git clone

$ cd node

$ sudo su –

# ./configure –openssl-libpath=/usr/lib/ssl
# make
# make test (ctrl+c se demorar demais os tests.)
# make install
# node -v

root@akrivis:~/node# node -v

Instalando npm (um espécie de instalador de módulos que está para node.js, assim, como está rubygems para ruby, easy_install ou pip para python, cpan para perl e por ai vai…):



root@akrivis:~/node# npm update
root@akrivis:~/node# npm -h

Usage: npm <command>

where <command> is one of:
add-user, adduser, apihelp, author, bin, bugs, c, cache,
completion, config, ddp, dedupe, deprecate, docs, edit,
explore, faq, find, find-dupes, get, help, help-search,
home, i, info, init, install, isntall, issues, la, link,
list, ll, ln, login, ls, outdated, owner, pack, prefix,
prune, publish, r, rb, rebuild, remove, repo, restart, rm,
root, run-script, s, se, search, set, show, shrinkwrap,
star, stars, start, stop, submodule, tag, test, tst, un,
uninstall, unlink, unpublish, unstar, up, update, v,
version, view, whoami

npm <cmd> -h quick help on <cmd>
npm -l display full usage info
npm faq commonly asked questions
npm help <term> search for help on <term>
npm help npm involved overview

Specify configs in the ini-formatted file:
or on the command line via: npm <command> –key value
Config info can be viewed via: npm help config

npm@1.3.9 /usr/local/lib/node_modules/npm