delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/10/07:30:29

From: "James Bulman" <james DOT bulman AT virgin DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Templates and warnings
Date: Sat, 10 Oct 1998 12:27:25 +0100
Organization: Virgin Net Usenet Service
Lines: 21
Message-ID: <6vngcd$n6e$1@nclient1-gui.server.virgin.net>
NNTP-Posting-Host: 194.168.18.130
X-Newsreader: Microsoft Outlook Express 4.72.3155.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi, I have recently switch to working with djgpp.

I am writing a basic double linked list template which uses a enum to return
the status of any operation. I have noticed though that I can write anything
in the return statement and the compiler does not complain.

For example (this is an example, not the exact code)

typedef enum listReturn {listAddOk = 1, listAddFail = 2, listRemoveOk = 3,
listRemoveFail = 4};

template <class letype>
listReturn list<letype>::next(void)
{
  /* do some stuff */
  return(any_old_rubbish_which_the_compiler_shouldnt_like);
}

This compiles fine, what am I doing wrong?


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019