- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Ansi C compiler Linux vs. HPUX
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2008 10:30 AM
тАО06-18-2008 10:30 AM
Ansi C compiler Linux vs. HPUX
I am trying to port some old Ansi C source code to Linux that was originally written and compiled on a HPUX machine. I would like to try and resolve this warning in the following code. It compiles without issue in HPUX.
ACME.c:227: warning: assignment makes integer from pointer without a cast
Problematic Code:
/* Strip off the directory path to the testspec, RKEEP */
strcpy(buf,Get_tag(&systemtag,"SYS_COMMENT",4));
while (strstr(buf,"/") != NULL) {
strcpy(buf,strstr(buf,"/")+1); }
printf("WOW =%s\n",buf);
Tmmp1=strstr(buf,"qk"); // Problem
Tmmp2=strstr(buf,"as"); // Problem
printf("Tmmp1: %d\n",Tmmp1);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2008 01:43 PM
тАО06-18-2008 01:43 PM
Re: Ansi C compiler Linux vs. HPUX
someone besides you knew which line was 227.
Still easier, if you supplied a whole failing
test program, instead of a fragment which
can't be compiled. (I can be at least as
lazy in debugging your problem as you can be
in presenting it.)
> It compiles without issue in HPUX.
Using which compiler? And what are you using
on your (unspecified) Linux system?
(I assume that you mean "without problems" or
"without complaints", rather than "without
issue". A compiler without issue is pretty
much a no-op.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2008 02:04 PM
тАО06-18-2008 02:04 PM
Re: Ansi C compiler Linux vs. HPUX
Thanks for the response.
I have denoted line 227 with //Problem in the snipet. Sorry about that.
I pretty sure for HPUX we are using cc and for Linux we are using gcc.
Yes, I mean it compiles in HPUX without any WARNINGS. But in Linux it give the the aforementioned WARNING.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2008 05:35 PM
тАО06-18-2008 05:35 PM
Re: Ansi C compiler Linux vs. HPUX
Version(s)?
> [...] for Linux we are using gcc [...]
Version?
But none of the usually useful info may make
any difference, because there's not enough
code here to identify a problem.
Can't see the "#include" directives.
Can't see the declarations of anything.
Can't see the compiler command(s).
Either I'm missing some obvious things, or
you failed to include them in your problem
description.
I might be able to write a program which
includes your program fragment, and which
either triggers similar complaints or not,
but my program would not be your program, and
there's no reason to imagine that solving any
problems with my program would help yours.
I'm still just as lazy as I was before. You,
too, apparently. If you would like actual
help with a program, try providing an actual
program. (Or try a psychic hotline. My
remote viewing ability is practically
nonexistent.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2008 06:21 PM
тАО06-18-2008 06:21 PM
Re: Ansi C compiler Linux vs. HPUX
gcc rev is 3.4.5-2, the HPUX cc compiler version is unknown at this point as the box is offline.
I have a attached source file. Check out line 226 and 227 I believe the problem has to do with type cast of Tmmp1 and Tmmp2 and buf. I have tried many combinations without success.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2008 08:16 PM
тАО06-18-2008 08:16 PM
Re: Ansi C compiler Linux vs. HPUX
But not "tbldata.h", making it a bit tough to
compile.
C comments delimited by "#"? Not very
portable:
alp $ cc /list 306754.c
#*****************************************************************************
.^
%CC-W-BADDIRECTIVE, "*" is an invalid preprocessor directive, and is being ignor
ed.
at line number 1 in file ALP$DKA0:[SMS.ITRC]306754.C;1
Line 148:
int wff, badd, DoNot, , Tmmp2, cob, boo, ick, idoit, tstnam;
So Tmmp2 is explicitly an "int". There's no
sign of a declaration of Tmmp1 (although
there is a suspicious hole), so it's
implicitly an "int".
dy # grep 'strstr(' /usr/include/*.h
/usr/include/string.h: extern char *strstr(const char *, const char *);
/usr/include/string.h: extern char *strstr();
(Or "man strstr".)
So strstr() is char *.
Thus
Tmmp1=strstr([...])
Tmmp2=strstr([...])
store a pointer into an "int", hence the
complaints. If you're storing pointers, put
them into pointers:
char *Tmmp1;
char *Tmmp2;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2008 08:47 PM
тАО06-18-2008 08:47 PM
Re: Ansi C compiler Linux vs. HPUX
alp $ cc /version
HP C V7.3-009 on OpenVMS Alpha V7.3-2
alp $ type 306754_x2.C
#include
main()
{
char buf[1024];
int Tmmp2;
Tmmp1=strstr(buf,"qk");
Tmmp2=strstr(buf,"as");
}
alp $ cc 306754_x2.C
Tmmp1=strstr(buf,"qk");
....^
%CC-E-UNDECLARED, In this statement, "Tmmp1" is not declared.
at line number 8 in file ALP$DKA0:[SMS.ITRC]306754_X2.C;1
Tmmp2=strstr(buf,"as");
....^
%CC-W-CVTDIFTYPES, In this statement, "strstr(...)" of type "pointer to char", is being converted to "int".
at line number 9 in file ALP$DKA0:[SMS.ITRC]306754_X2.C;1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-19-2008 05:30 AM
тАО06-19-2008 05:30 AM
Re: Ansi C compiler Linux vs. HPUX
alp $ type 306754_ok.c
#include
main()
{
char buf[1024];
char *Tmmp1;
char *Tmmp2;
Tmmp1=strstr(buf,"qk");
Tmmp2=strstr(buf,"as");
}
alp $ cc 306754_ok.c
alp $