• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: Help with type_id and fstream
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Help with type_id and fstream


  • Subject: RE: Help with type_id and fstream
  • From: "Luca Ciciriello" <email@hidden>
  • Date: Mon, 03 Sep 2007 17:39:51 +0100

Another thing. Have you used:  "using namespace std"?

luca


From: Dale Satterfield <email@hidden>
To: email@hidden
Subject: Help with type_id and fstream
Date: Sun, 2 Sep 2007 18:18:49 -0700

I am just getting back into programming so am a bit rusty on some things, but this just seems bizarre. I am trying to build a C++ Command Line app, as that seems the closes to a plain
C++ program without all the user interface stuff. I am trying to include some code from a book C++ Algorthyms for DSP. In it there is the following function:
//////////////////////////////////////////////////////////////////////// ///
//
// convType( const type_info& ti )
// Converts C++ run-time type information to C DSP_FILE
//
// Returns:
// Enumerated C DSP_FILE type (see DSPFILETYPE above)
//
//////////////////////////////////////////////////////////////////////// ///
// error: ISO C++ forbids declaration of 'type_info' with no type
inline DSPFILETYPE convType( const type_info &ti )
{
// Convert type to C DSP_FILE type
if( ti == typeid( unsigned char ) ) return UNSIGNED_CHAR;
else if( ti == typeid( signed char ) ) return SIGNED_CHAR;
else if( ti == typeid( unsigned short ) ) return UNSIGNED_SHORT;
else if( ti == typeid( signed short ) ) return SIGNED_SHORT;
else if( ti == typeid( unsigned long ) ) return UNSIGNED_LONG;
else if( ti == typeid( signed long ) ) return SIGNED_LONG;
else if( ti == typeid( float ) ) return FLOAT;
else if( ti == typeid( double ) ) return DOUBLE;


	// Additional types for C++
	else if( ti == typeid( unsigned int ) ) return UNSIGNED_INT;
	else if( ti == typeid( signed int ) ) return SIGNED_INT;
	else if( ti == typeid( Complex ) ) return COMPLEX;

	return UNKNOWN_TYPE;
}

This causes the compiler to complain:"error: ISO C++ forbids declaration of 'type_info' with no type." on the line DSPFILETYPE convType(
This does not appear to be a declaration to me. In addition, in one of my C++ books I see this exact usage. I am at a loss to figure out why.
In the original code, which was I admit written to compile under Visuall C++, there was an include for #include <typeinfo.h> which caused the compiler to barf, so I removed it.
Is there an equivalent that I need to include ?


I also am getting errors on the declaration fstream m_fs. it says "error: 'fstream' does not declare a type. I see this exact type of declaration in my C++ book, and I cannot
see anything in the headers that contradict it.


I am baffled by these errors.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_________________________________________________________________
Can you see your house from the sky? Try Live Search Maps http://maps.live.com


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Help with type_id and fstream (From: Dale Satterfield <email@hidden>)

  • Prev by Date: RE: Help with type_id and fstream
  • Next by Date: Re: Tricky "inline-assembly/C++ template" issue
  • Previous by thread: RE: Help with type_id and fstream
  • Next by thread: Adding Help
  • Index(es):
    • Date
    • Thread