Gems

  • Gem #157: Gprbuild and Code Generation

    This series of Gems explains how gprbuild can be configured to invoke code generators before it compiles the resulting code itself. Continue Reading in Ada Answers »

    Emmanuel Briot
    AdaCore
  • Gem #156: Listing Control in GNAT

    There are many options for generating and controlling output from the compiler. Often these are not sufficiently well known, since they are buried in complex documentation. This Gem takes a look at the options and shows how they can be used to refine the output you get from the compiler. Continue Reading in Ada Answers »

    Robert Dewar
    AdaCore
  • Gem #155: Enhancing the GPRBuild Database for a New Language

    It is possible to enhance the GPRbuild database with a new XML file that describes the characteristics of a new language. Then, a project file where this language is declared will automatically invoke the compiler for the sources of this language with all the necessary options. Continue Reading in Ada Answers »

    Vincent Celier
    AdaCore
  • Gem #154: Multicore Maze Solving, Part 2

    This series of Gems describes the concurrent maze solver project ("amazing") included with the GNAT Pro examples. The first Gem in the series introduced the project itself and explained the concurrent programming design approach. This second Gem explores the principal change that was required for optimal performance on multicore architectures. This change solved a critical performance bottleneck that was not present when the original program was first deployed in the 1980s, illustrating one of the fundamental differences between traditional multiprocessing and modern multicore programming.

    Continue Reading in Ada Answers »

    Pat Rogers
    AdaCore
  • Gem #153: Multicore Maze Solving, Part 1

    This Gem series introduces the "amazing" project included with the GNAT Pro compiler examples. The project is so named because it involves maze solving (as in "Joe and Julie go a-mazing"). But these aren’t typical mazes that have only one solution. These mazes can have many solutions, tens of thousands, for example. The point is to find all of them as quickly as possible. Therefore, we solve the mazes concurrently, applying multiple CPUs in a divide-and-conquer design. In this first Gem we introduce the program and explain the approach. Continue Reading in Ada Answers »

    Pat Rogers
    AdaCore
  • Gem #152 : Defining a New Language in a Project File

    It's possible to use a programming language that is not known by default to gprbuild. One way of doing this is to define all the characteristics of the language in a project file.

    Continue Reading in Ada Answers »

    Vincent Celier
    AdaCore
  • Gem #151 : Specifying Mathematical Properties of Programs

    With the addition of many new kinds of assertions in Ada 2012, it is tempting to state properties of your data that "forget" about the possibility of overflows. GNAT has defined a compilation switch and a pragma that make it possible.

    Continue Reading in Ada Answers »

    Yannick Moy
    AdaCore
  • Gem #150: Out and Uninitialized

    This Gem describes some perhaps unexpected cases where variables aren't necessarily updated following assignments, though it might not be obvious from the code.

    Continue Reading in Ada Answers »

    Emmanuel Briot
    AdaCore
    Robert Dewar
    AdaCore
  • Gem #149 : Asserting the truth, but (possibly) not the whole truth

    In Ada 2012, assertions that state desired properties of programs are not limited to pragma Assert. This Gem presents how pragma Assertion_Policy can be used to control which of these assertions should be executed at run time.

    Continue Reading in Ada Answers »

    Yannick Moy
    AdaCore
  • Gem #148 : Su(per)btypes in Ada 2012 - Part 3

    In the previous two Gems of this series, we saw how the aspects Static_Predicate and Dynamic_Predicate can be used to state properties of objects that should be respected at all times. This Gem is concerned with the Type_Invariant aspect.

    Continue Reading in Ada Answers »

    Yannick Moy
    AdaCore
  • Gem #147 : Su(per)btypes in Ada 2012 - Part 2

    In the previous Gem in this series, we saw how the aspect Static_Predicate can be used to state properties of scalar objects that should be respected at all times. This Gem is concerned with the Dynamic_Predicate aspect.

    Continue Reading in Ada Answers »

    Yannick Moy
    AdaCore
  • Gem #146 : Su(per)btypes in Ada 2012 - Part 1

    The new revision of Ada is full of features for specifying properties of types. In this series of three Gems, we describe three aspects that can be used to state invariant properties of types. This first Gem is concerned with the Static_Predicate aspect.

    Continue Reading in Ada Answers »

    Yannick Moy
    AdaCore
  • Gem #145: Ada Quiz 3 - Statements

    Abstract: Extracted from the AdaCore training courses, this Gem about "Statements" carries on with the series of occasional quizzes on Ada language features.

    Continue Reading in Ada Answers »

    Valentine Reboul
    AdaCore
  • Gem #144: A Bit of Bytes: Characters and Encoding Schemes

    This Gem describes some of the concepts behind character encoding and Unicode. It explains why multiple character sets exist, and how to deal with them in your application if you want to handle international input and output.

    Continue Reading in Ada Answers »

    Emmanuel Briot
    AdaCore
  • Gem #143 : Return to the Sources

    The GNAT technology introduced the notion of projects with its 3.15 release in 2002. This notion was revisited and stabilized in later versions, and projects are now supported by all GNAT tools. They are a convenient way to describe how the sources of your application are organized, and how they should be manipulated by the various tools. They can also be used from your own tools through a convenient API in the GNAT Components Collection, which this Gem introduces.

    Continue Reading in Ada Answers »

    Emmanuel Briot
    AdaCore
  • Gem #142 : Exception-ally

    The GNAT compiler is well known for the quality of its error messages. This also extends to the messages associated with exceptions, and this Gem shows a few ways that these can be made more useful.

    Continue Reading in Ada Answers »

    Emmanuel Briot
    AdaCore
  • Gem #141 : Con-figure it out

    In the Gem series on GNAT.Command_Line (Gems #138 and #139), we mentioned that there are several ways a user can control the behavior of an application. These are command-line options (as discussed in that Gem), graphical user applications (for instance using GtkAda), and configuration files. This Gem proposes various approaches for the latter.

    Continue Reading in Ada Answers »

    Emmanuel Briot
    AdaCore
  • Gem #140: Bridging the Endianness Gap

    An IT engineer has to make two essential choices in life:

    • Shall I break my soft-boiled egg from the big end, or from the little end?
    • When storing a multibyte value, shall I store it most significant byte first, or least significant byte first?
    More than thirty years has passed since Danny Cohen made his plea for peace between big endians and little endians, and software is still plagued with all manner of byte-swapping code to accommodate data produced by systems of different obediences. Can languages come to the rescue?

    Continue Reading in Ada Answers »

    Thomas Quinot
    AdaCore
  • Gem #139 : Master the Command Line - Part 2

    The first part of this Gem series described how to use GNAT.Command_Line to retrieve the switches and arguments passed to an application. This still requires writing quite a lot of code. In this part we explain the high-level API of GNAT.Command_Line and show how to make command-line management a breeze.

    Continue Reading in Ada Answers »

    Emmanuel Briot
    AdaCore
  • Gem #138 : Master the Command Line - Part 1

    Applications can be configured in multiple ways. Among the most frequent are command-line options, configuration files, and graphical user interfaces. The GNAT technology provides various means to interface with those: Ada.Command_Line and GNAT.Command_Line, GNATCOLL.Config, and GtkAda. The latter two will be discussed in later Gems; this series of two Gems will describe how to manipulate the command line.

    Continue Reading in Ada Answers »

    Emmanuel Briot
    AdaCore
   1  2  3     Next »