[comp.lang.c] MSC mixed model programming question

devine@cookie.dec.com (Bob Devine) (10/01/88)

> 0012  typedef struct tree_s far * TREEPTR;
> 0013  
> 0018  static TREEPTR func(TREEPTR *ppr)
> 0019  {
> 0020  	if (func(&(*ppr)->tree_l) == (TREEPTR) 0)
> 0021  		return (TREEPTR) 0;
> 0022  }
>  
> func.c(20) : warning C4062: near/far mismatch in argument : conversion supplied
> func.c(20) : warning C4060: conversion of long address to short address

  The typedef TREEPTR is correctly made.  However the function
prototype mixes far pointers and pointers that default to near
unless you select another memory model (isn't the x86 model wonderful?).

  For the prototype stick in another `far' in front of the `*' to
match the declaration for `tree_l'.
<> 0018  static TREEPTR func(TREEPTR far * ppr)

  For the assonance-lovers among the readers, pronounce the decl:
"char far * far * foobar;"