static std string troubles. 
Author Message
 static std string troubles.

VC6.0 no SPs

Compiles and runs.

Sergei

Quote:

> #include<string>
> using namespace std;

> int test(string a)
> {
>  return a.size();
> }

> string data;
> int length=test(data);//statement that causes failure.

> int main()
> {
>  return 0;
> }

>   The above code causes an internal compiler error with VC5.0 but I don't
> understand why, the same code works fine with fundamental types and user
> defined classes. What am I doing wrong please?



Fri, 15 Nov 2002 03:00:00 GMT  
 static std string troubles.
everything is all right. at least on VC++ v6.0.
it might be a compiler bug in your version of VC......
Quote:
> #include<string>
> using namespace std;

> int test(string a)
> {
>  return a.size();
> }

> string data;
> int length=test(data);//statement that causes failure.

> int main()
> {
>  return 0;
> }

>   The above code causes an internal compiler error with VC5.0 but I don't
> understand why, the same code works fine with fundamental types and user
> defined classes. What am I doing wrong please?



Fri, 15 Nov 2002 03:00:00 GMT  
 static std string troubles.
Thanks to everyone who checked that for me. Do Microsoft provide the
version 6 command line compiler for free download<g>? Would it be
possible to use the free Borland 5.5 compiler as a back end for the
Devstudio IDE? I'm thinking it might be more ANSI compliant and less
error prone and maybe faster, I know I can switch off the Microsoft
extensions but the version of the STL that I have requires them (which
makes me wonder what the 'S' in STL stands for).

Sent via Deja.com http://www.deja.com/
Before you buy.



Fri, 15 Nov 2002 03:00:00 GMT  
 static std string troubles.

Quote:
> Would it be
> possible to use the free Borland 5.5 compiler as a back end for the
> Devstudio IDE?

   There are a couple of things you can do. One is to add BC as a tool to
the Tools menu of Devstudio by Tools | Customize | Tools. The other would be
to write a program that takes VC command lines (as VC uses different flags
to BC) and calls BC with substituted flags, name it CL, and make sure its
called rather than VC.

Quote:
> I'm thinking it might be more ANSI compliant and less
> error prone and maybe faster, ...

    There doesn't seem to be much speed difference to me. I don't know about
any compliance problems or errors as they both run my code correctly. The
thing I like about Borland is how picky it is with warnings. This generates
some false hits when its a bit agressive with its flow analysis (I like to
initialise variables even when I know that they will be assigned again on
every possible path) but is often helpful.

   Neil



Sat, 16 Nov 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. static std::string exposed through System::String *

2. convert non std::string to std::string

3. convert between std::string and std::wstring

4. Warnings for std::vector<std::string>

5. typedef std::vector<std::string> Vector_String

6. std::hash_map with std::string as a key

7. basic std::stringstream and std::string questions

8. int to std::string to System::String

9. String to std:string

10. System::String to std::string

11. System.String to std::string conversion

12. null-terminated string to std::string

 

 
Powered by phpBB® Forum Software