Path: utzoo!utgpu!news-server.csri.toronto.edu!eecg.toronto.edu!zq Newsgroups: comp.lang.c++ From: zq@eecg.toronto.edu (Qing Zheng) Subject: Buggs in AT&T C++ 2.1 on Sun SPARC (SunOs 4.1) ? Message-ID: <1991Mar24.143453.6671@jarvis.csri.toronto.edu> Distribution: comp Date: 24 Mar 91 19:34:53 GMT Lines: 82 The following could be the buggs of AT&T C++ 2.1 on Sun SPARC (SunOs 4.1) 1) return type conflict for alloca() ---- C++ header file alloca.h -------- /*ident "@(#)C++env:incl-master/proto-headers/alloca.h 1.2" */ #ifndef __ALLOCA_H #define __ALLOCA_H /* @(#)alloca.h 1.4 88/08/19 SMI */ #ifndef _alloca_h #define _alloca_h #if defined(sparc) # define alloca(x) __builtin_alloca(x) #endif #endif /*!_alloca_h*/ extern "C" { void *__builtin_alloca(int); } /* ^^^^^ the return type is void* */ #endif ---- C++ header file malloc.h ------ /*ident "@(#)C++env:incl-master/proto-headers/malloc.h 1.1" */ #ifndef __MALLOC_H #define __MALLOC_H ...... extern "C" { char *malloc(size_t); void free(void*); void cfree(void*); char *realloc(void*, size_t); char *calloc(unsigned, size_t); int mallopt(int, int); struct mallinfo mallinfo(int); char *memalign(unsigned, size_t); char *valloc(size_t); int malloc_debug(int); int malloc_verify(); char *alloca(int); } /* ^^^^^^ here the return type is char* */ #endif 2) Since in the SunOS 4.1 header file /usr/include/unistd.h already constains some external function declaration such as ... extern char *getlogin(/* void */); ... these declarations will also be contained in the C++ header file unistd.h after being expanded during 'make scratch'. The correct declaration should be : extern "C" { ... char *getlogin(); ... } instead of extern char *getlogin(/* void */); which is a C++ function declaration. Actually this function is already declared in C++ header file stdlib.h as extern "C" { ... char *getlogin(); ... } Any idea of how to fix these buggs properly ? Thanks in advance. ----Qing