Tutorial 5

Mark Butcher M_J_BUTCHER@compuserve.com
Thu Jun 27 15:33:00 GMT 2002


Hi All

Who understands the following code ? (extract from std_cstdlib.h - gcc 3.1)

**********************************
#pragma GCC system_header

#include <bits/c++config.h>
#include <cstlib.h>
#include <stdlib.h>

namespace std 
{
  using ::div_t;   
  using ::ldiv_t;  

.....

  inline long 
  abs(long __i) { return labs(__i); }

  inline ldiv_t
  div(long __i, long __j) { return ldiv(__i, __j); } 
} 
**********************************
When compiling the c++ library source (eh_alloc.cc) there are errors
because div_t and ldiv_l are not declared.

I have read through some documents in the gcc source and tried to find
something in my C++ book but must admit to not becoming much wiser. Since I
don't understand what the code is doing and can't see the relationship
between included files and configuration/target setup I'm a bit stumped.
(Same error when using mcore-elf and arm-elf targets).

So what is the code ? How does the syntax work ? How can it go wrong ? Can
a configuration problem / error lead to a failure ?


Regards

Mark





More information about the Gcc-help mailing list