PATCH for pgconnection.h
I am using the Sun Workshop C 5.0, noticed that I was getting the
following errors:
"pgconnection.h", line 65: Error: string is not defined.
"pgconnection.cc", line 134: Error: string is not defined.
"pgconnection.cc", line 139: Error: Cannot return char* from a function
that should return int.
3 Error(s) detected.
Futher looking noticed that the standard namespace was not being used
for the "string" typedef, so the following patch fixed that for me.
This is for the 6.5 tar release & the 6/24 CVS checkout.
vlad: diff -w3c interfaces/libpq++/pgconnection.h.orig
interfaces/libpq++/pgconnection.h
*** interfaces/libpq++/pgconnection.h.orig Thu Jun 24 10:49:54 1999
--- interfaces/libpq++/pgconnection.h Thu Jun 24 10:48:31 1999
***************
*** 23,28 ****
--- 23,34 ----
#include <stdio.h>
#include <string>
+ #ifdef __sun__
+ #ifndef __GNUC__
+ using namespace std;
+ #endif
+ #endif
+
extern "C" {
#include "libpq-fe.h"
}
--
Brian Millett
Enterprise Consulting Group "Heaven can not exist,
(314) 205-9030 If the family is not eternal"
bpm@ec-group.com F. Ballard Washburn
This is the second mention of 'namespace' I have seen. Can we allow
this by default?
Of course, I get:
pgconnection.h:26: warning: namespaces are mostly broken in this version of g++
but it still works. Comments?
I am using the Sun Workshop C 5.0, noticed that I was getting the
following errors:
"pgconnection.h", line 65: Error: string is not defined.
"pgconnection.cc", line 134: Error: string is not defined.
"pgconnection.cc", line 139: Error: Cannot return char* from a function
that should return int.
3 Error(s) detected.Futher looking noticed that the standard namespace was not being used
for the "string" typedef, so the following patch fixed that for me.
This is for the 6.5 tar release & the 6/24 CVS checkout.vlad: diff -w3c interfaces/libpq++/pgconnection.h.orig
interfaces/libpq++/pgconnection.h
*** interfaces/libpq++/pgconnection.h.orig Thu Jun 24 10:49:54 1999--- interfaces/libpq++/pgconnection.h Thu Jun 24 10:48:31 1999 *************** *** 23,28 **** --- 23,34 ---- #include <stdio.h> #include <string>+ #ifdef __sun__ + #ifndef __GNUC__ + using namespace std; + #endif + #endif + extern "C" { #include "libpq-fe.h" }--
Brian Millett
Enterprise Consulting Group "Heaven can not exist,
(314) 205-9030 If the family is not eternal"
bpm@ec-group.com F. Ballard Washburn
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
On 08-Jul-99 Bruce Momjian wrote:
This is the second mention of 'namespace' I have seen. Can we allow
this by default?Of course, I get:
pgconnection.h:26: warning: namespaces are mostly broken in this version of g++
but it still works. Comments?
Um.. No? Are you also using SWC 5.0? And if it's g++, do we have a version
besides Sun's? Sorry, I'm not familiar with Sun stuff.
Vince.
I am using the Sun Workshop C 5.0, noticed that I was getting the
following errors:
"pgconnection.h", line 65: Error: string is not defined.
"pgconnection.cc", line 134: Error: string is not defined.
"pgconnection.cc", line 139: Error: Cannot return char* from a function
that should return int.
3 Error(s) detected.Futher looking noticed that the standard namespace was not being used
for the "string" typedef, so the following patch fixed that for me.
This is for the 6.5 tar release & the 6/24 CVS checkout.vlad: diff -w3c interfaces/libpq++/pgconnection.h.orig
interfaces/libpq++/pgconnection.h
*** interfaces/libpq++/pgconnection.h.orig Thu Jun 24 10:49:54 1999--- interfaces/libpq++/pgconnection.h Thu Jun 24 10:48:31 1999 *************** *** 23,28 **** --- 23,34 ---- #include <stdio.h> #include <string>+ #ifdef __sun__ + #ifndef __GNUC__ + using namespace std; + #endif + #endif + extern "C" { #include "libpq-fe.h" }--
Brian Millett
Enterprise Consulting Group "Heaven can not exist,
(314) 205-9030 If the family is not eternal"
bpm@ec-group.com F. Ballard Washburn-- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
--
==========================================================================
Vince Vielhaber -- KA8CSH email: vev@michvhf.com flame-mail: /dev/null
# include <std/disclaimers.h> TEAM-OS2
Online Campground Directory http://www.camping-usa.com
Online Giftshop Superstore http://www.cloudninegifts.com
==========================================================================
On 08-Jul-99 Bruce Momjian wrote:
This is the second mention of 'namespace' I have seen. Can we allow
this by default?Of course, I get:
pgconnection.h:26: warning: namespaces are mostly broken in this version of g++
but it still works. Comments?
Um.. No? Are you also using SWC 5.0? And if it's g++, do we have a version
besides Sun's? Sorry, I'm not familiar with Sun stuff.Vince.
I am using g++ in gcc 2.7.1.
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Bruce Momjian wrote:
On 08-Jul-99 Bruce Momjian wrote:
This is the second mention of 'namespace' I have seen. Can we allow
this by default?Of course, I get:
pgconnection.h:26: warning: namespaces are mostly broken in this version of g++
but it still works. Comments?
Um.. No? Are you also using SWC 5.0? And if it's g++, do we have a version
besides Sun's? Sorry, I'm not familiar with Sun stuff.Vince.
I am using g++ in gcc 2.7.1.
Remember way back when when I had a
#include <something>
and it caused problems for some people who really needed
#include <something.h>
Now I think (but am certainly not sure!) that the difference between the
two was meant to be that in the first instance, the standard namespace
is used. I can't really follow what's happening as
% cvs status pgconnection.cc
Fatal error, aborting.
: no such user
We just changed the first to the second as in g++ all that <something>
does is to include <something.h>, but it may not be true for other compilers.
Hope someone with a reference book near them can check this!
Cheers,
Patrick
Bruce Momjian <maillist@candle.pha.pa.us> writes:
+ #ifdef __sun__ + #ifndef __GNUC__ + using namespace std; + #endif + #endif
The above is really, really ugly, not to say broken, because neither
being on a Sun nor using gcc have anything to do with whether your
compiler handles namespaces. The problem we are looking at here is that
the C++ standard is a moving target, and some people have compilers that
are newer than others.
I think the proper solution is to add a configure-time test to see
whether a namespace declaration is needed. We could use configure to
see whether we need ".h" on the end of C++ include file references, too.
(That's another thing that's going to be site-dependent for a while to
come.)
regards, tom lane
Import Notes
Reply to msg id not found: YourmessageofWed7Jul1999220252-0400199907080202.WAA19810@candle.pha.pa.us | Resolved by subject fallback
On Thu, 8 Jul 1999, Tom Lane wrote:
I think the proper solution is to add a configure-time test to see
whether a namespace declaration is needed. We could use configure to
see whether we need ".h" on the end of C++ include file references, too.
(That's another thing that's going to be site-dependent for a while to
come.)
Hmmm. I'm running 2.7.2.1 here and in the case of <string> I have a
file called: /usr/include/g++/string <-- note there's no .h on the end.
Am I being dense here and missing something or does this differ from what
other folks have? There's also a number of other files without the .h
extension in that directory. string includes std/string.h.
Vince.
--
==========================================================================
Vince Vielhaber -- KA8CSH email: vev@michvhf.com flame-mail: /dev/null
# include <std/disclaimers.h> TEAM-OS2
Online Campground Directory http://www.camping-usa.com
Online Giftshop Superstore http://www.cloudninegifts.com
==========================================================================
Vince Vielhaber <vev@michvhf.com> writes:
On Thu, 8 Jul 1999, Tom Lane wrote:
I think the proper solution is to add a configure-time test to see
whether a namespace declaration is needed. We could use configure to
see whether we need ".h" on the end of C++ include file references, too.
(That's another thing that's going to be site-dependent for a while to
come.)
Hmmm. I'm running 2.7.2.1 here and in the case of <string> I have a
file called: /usr/include/g++/string <-- note there's no .h on the end.
Am I being dense here and missing something or does this differ from what
other folks have?
Same as what I have, but I'm using gcc 2.7.2.2 so that's not real
surprising. I was under the impression that naming conventions for
C++ library include files have changed at least once in the development
of the C++ standards --- but I may be mistaken.
regards, tom lane
Import Notes
Reply to msg id not found: YourmessageofThu8Jul1999110412-0400Pine.BSF.4.05.9907081100020.28563-100000@paprika.michvhf.com | Resolved by subject fallback
Bruce Momjian <maillist@candle.pha.pa.us> writes:
+ #ifdef __sun__ + #ifndef __GNUC__ + using namespace std; + #endif + #endif
Yes, never applied.
The above is really, really ugly, not to say broken, because neither
being on a Sun nor using gcc have anything to do with whether your
compiler handles namespaces. The problem we are looking at here is that
the C++ standard is a moving target, and some people have compilers that
are newer than others.I think the proper solution is to add a configure-time test to see
whether a namespace declaration is needed. We could use configure to
see whether we need ".h" on the end of C++ include file references, too.
(That's another thing that's going to be site-dependent for a while to
come.)
I smell TODO list:
* Add configure test to check for C++ need for *.h and namespaces
Added.
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
On Thu, 8 Jul 1999, Tom Lane wrote:
I think the proper solution is to add a configure-time test to see
whether a namespace declaration is needed. We could use configure to
see whether we need ".h" on the end of C++ include file references, too.
(That's another thing that's going to be site-dependent for a while to
come.)Hmmm. I'm running 2.7.2.1 here and in the case of <string> I have a
file called: /usr/include/g++/string <-- note there's no .h on the end.
Am I being dense here and missing something or does this differ from what
other folks have? There's also a number of other files without the .h
extension in that directory. string includes std/string.h.
We remove .h, and someone complains, we add .h, and someone complains,
but fewer people. Configure is the answer.
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
On Thu, 8 Jul 1999, Bruce Momjian wrote:
Bruce Momjian <maillist@candle.pha.pa.us> writes:
+ #ifdef __sun__
+ #ifndef __GNUC__
Looks like someone's mailer reinjected this one.
Vince.
--
==========================================================================
Vince Vielhaber -- KA8CSH email: vev@michvhf.com flame-mail: /dev/null
# include <std/disclaimers.h> TEAM-OS2
Online Campground Directory http://www.camping-usa.com
Online Giftshop Superstore http://www.cloudninegifts.com
==========================================================================
On Thu, 8 Jul 1999, Bruce Momjian wrote:
Bruce Momjian <maillist@candle.pha.pa.us> writes:
+ #ifdef __sun__
+ #ifndef __GNUC__Looks like someone's mailer reinjected this one.
We removed the __sun__ line because it was considered strange.
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
On Mon, 26 Jul 1999, Bruce Momjian wrote:
On Thu, 8 Jul 1999, Bruce Momjian wrote:
Bruce Momjian <maillist@candle.pha.pa.us> writes:
+ #ifdef __sun__
+ #ifndef __GNUC__Looks like someone's mailer reinjected this one.
We removed the __sun__ line because it was considered strange.
Look at the date of the message. Someone from a2000.nl is reinjecting
messages to the list. That's all my note was about. I've seen a few
of 'em so far this mourning.
Vince.
--
==========================================================================
Vince Vielhaber -- KA8CSH email: vev@michvhf.com flame-mail: /dev/null
# include <std/disclaimers.h> TEAM-OS2
Online Campground Directory http://www.camping-usa.com
Online Giftshop Superstore http://www.cloudninegifts.com
==========================================================================