Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Macros should not be confused with other compiled code, and they should be
used only while bearing in mind how they work, namely by modifying the
source code prior to passing it to the compiler. Trying to employ macros to do
jobs that cannot be done before compilation, but rather depends on the
program's compiled state or the execution yields is a common mistake that
beginners make
Its advantages-
The main advantage of using the macro is the speed of the execution of the program (if macro
is not used in the program many times or if the program is small).
The main disadvantage of the macro is it increase the size of the program because the pre-
processor will replace all the macro name in the program by it actual definition before the
compilation of the program
The excessive use of macros for purposes achievable by run-time techniques is not
recommended, and somehow deprecated. Nevertheless, macros sometimes are viable tools
that have no other alternative, such as the case with assertions.
MODULES
A module is a software unit that groups a set of data structures and subprograms/routines,
which are typically cohesive. Modules are entities that are separately compiled by
programmers to make them reusable. This allows programmers to work of different modules
simultaneously. Modules promote two important elements of software programming:
These elements make complex programs simpler to grasp. Most programs are composed of
one or more modules that are developed independently. To explain modules in a detailed
manner, we will take the example of the Perl module.
A Perl module is a separate component of program for the Perl programming language. As
you know Perl allows many different style of programming. You will find a module written
as object-oriented (like the XML-Parser) or in a procedural style (e.g. Test-Simple). Modules
in Perl language can also be used to change the syntax of the language or for mixing methods.
A collection of one or more modules, including build scripts and documentation, compose a
distribution. The Perl programming community has a huge library of distributions.