Path: utzoo!mnetor!uunet!husc6!mit-eddie!cybvax0!amit From: amit@cybvax0.UUCP (Amit Green) Newsgroups: comp.lang.c++ Subject: (Cybermation #2) Fixing error format strings in cfront Message-ID: <1511@cybvax0.UUCP> Date: 6 Jan 88 03:16:29 GMT Reply-To: amit@cybvax0.UUCP (Amit Green) Organization: Cybermation, Inc., Cambridge, MA Lines: 31 History: The error passing mechanism of cfront (the c++ front end) is very ingenious; is uses references to automatically constructed arguments to pass each one of the variable arguments. I have modified it to actually record the type of each of the passed arguments, and then compare it with the format string, for each argument; thus, this does run time type checking. As time goes by, I expect to find all the mismatched format strings with their arguemnts. Code: table.c (from cfront 1.2.1) can be improved: table.c:1: /*ident "@(#)cfront:src/table.c 1.6" */ table.c:126: if (s==0) error('i',"%d->insert(0,%d)",this,k); norm.c (from cfront 1.2.1) can be improved: norm.c:1: /*ident "@(#)cfront:src/norm.c 1.10" */ norm.c:602: error('i',"tname(%s %d %k)",string,this,base); Suggested improvments: table.c:126: if (s==0) error('i',"%p->insert(0,%k)",this,k); norm.c:602: error('i',"tname(%s %p %k)",string,this,base); Note: The changes to the error handler, cannot be put here, as they incorporate extensive code changes. Amit Green {harvard,mit-eddie}!cybvax0!amit