C++: Anticipated declaration of builtins

gcc@integrable-solutions.net gcc@integrable-solutions.net
Sun May 25 22:13:00 GMT 2003


Hi,

Currently, anticipated declarations of builtin functions whose names do
not begin with underscores are done as follows:

  * a pre-declaration at the standard namespace scope std::
  * a pre-declaration at the global scope.

The actual code reads:

  /* All builtins that don't begin with an '_' should additionally
     go in the 'std' namespace.  */
  if (name[0] != '_')
    {
      push_namespace (std_identifier);
      builtin_function_1 (name, type, std_node, code, class, libname, attrs);
      pop_namespace ();
    }

  return builtin_function_1 (name, type, NULL_TREE, code,
			     class, libname, attrs);

I have two questions:

  1) Shouldn't we pre-declare the function at global scope, then do a
     using-declaration at the standard scope?

  2) Why doesn't the second call to builtin_function_1() specify
     global_namespace instead of NULL_TREE?  I think specifying
     global_namespace should be the way to go.  What I am missing?

Thanks,

-- Gaby



More information about the Gcc mailing list