The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Reg expression For Harikrishna Shell Programming and Scripting 2 05-06-2008 10:40 PM
nawk empty regular expression error Rjkz Shell Programming and Scripting 6 12-21-2007 07:07 AM
OR expression Rock UNIX for Dummies Questions & Answers 3 05-03-2007 05:50 AM
Regular Expression + Aritmetical Expression Z0mby Shell Programming and Scripting 2 05-21-2002 07:59 AM
compound expression in unix spalmer UNIX for Dummies Questions & Answers 3 10-19-2001 09:04 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-13-2007
Registered User
 

Join Date: Sep 2007
Posts: 62
error: initializer expression list treated as compound expression

I had seen this error for the first time .....
error: initializer expression list treated as compound expression
please help....
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 11-13-2007
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,858
This sounds like a compiler error. We need a LOT more information.
Reply With Quote
  #3 (permalink)  
Old 11-13-2007
Registered User
 

Join Date: Sep 2007
Posts: 62
I dont know why it has occured .........
but when I compiled my program again after some time taking ....having some modifications in my code i.e collecting a return value of a function in a variable then this problem disappears....and my code working correctly....

but today when I again not collecting the return value of a function then also its working correctly...........

why so???????????
Reply With Quote
  #4 (permalink)  
Old 11-13-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
We don't know what operating system, what programming language or what compiler you are using.

We have no idea what code it is you had that failed to compile, we have no idea what changes you made.

So we're in more of the dark than you.
Reply With Quote
  #5 (permalink)  
Old 11-13-2007
Registered User
 

Join Date: Sep 2007
Posts: 62
Operating system, --> Linux(Fedora 6)
Programming language or what compiler --> C++/g++ compiler

What changes I had made.--> first of all I was calling my own made function and not collecting what it is returning.....then I simply taken a variable and collected a returned value from that function.......that compilation error then disappers.

I am not using the concept of class here simply defining a function and calling it main.

So I just only want to know that what that error means because I had never seen it before & what is compound expression?????????
Reply With Quote
  #6 (permalink)  
Old 11-14-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by arunchaudhary19 View Post
So I just only want to know that what that error means because I had never seen it before & what is compound expression?????????
Why not post the offending section of source code with immediate surrounds and any appropriate prototypes, it might help us tell you what may be going on.

If you do a good for "error: initializer expression list treated as compound expression" there are many cases of people having that error.
Reply With Quote
  #7 (permalink)  
Old 11-14-2007
Registered User
 

Join Date: Sep 2007
Posts: 62
ok...........here is the section of my code..........

from main I am Calling function.......
setup_ipc("msqueue",1234,INPUT_IPC,LARGE_QUEUE);
and its defination is in another *.cpp file

and here is its defination
int setup_ipc (const char * ipc_name, long base_add, int io_type, int ipc_qtype)
{
char sbuffer[FILENAMELEN + 1];
key_t msg_key;
int msg_flag;
if ((io_type != INPUT_IPC && io_type != OUTPUT_IPC) ||
(ipc_qtype != SMALL_QUEUE && ipc_qtype != LARGE_QUEUE &&
ipc_qtype != PRI_QUEUE && ipc_qtype != MAIL_BOX &&
ipc_qtype != SOCKET_QUEUE)) {return(-1);}

if (!(*ipc_name)) {return(-1);}

/** look for the end of ipc_tbl **/
lipc_tbl = &ipc_lhead;
for (ipc_tbl = ipc_lhead.ipc_nextent; ipc_tbl;lipc_tbl = ipc_tbl, ipc_tbl = ipc_tbl->ipc_nextent);

ipc_tbl = (struct ipc_ent *) malloc(sizeof(struct ipc_ent));
if ( !ipc_tbl ) {return(-1);}

/** init table entry variables **/
strncpy(sbuffer, ipc_name, FILENAMELEN);
sbuffer[FILENAMELEN - 1] = '\0';
sprintf(ipc_tbl->fname, "%s", sbuffer);
ipc_tbl->ipc_tag = ++ipc_ecnt;
ipc_tbl->io_type = io_type;
ipc_tbl->vlmsg_id = -1;
ipc_tbl->sockfd = -1;
ipc_tbl->vlkey_id = base_add;
ipc_tbl->qtype = ipc_qtype;
ipc_tbl->ipc_nextent = NULL;

/** open message queue **/
if (ipc_qtype != SOCKET_QUEUE)
{
msg_key = ipc_tbl->vlkey_id;
if (io_type == INPUT_IPC)
msg_flag = IPC_CREAT | IPC_EXCL | 0666;
else
msg_flag = 0666;

errno = 0;
while ((ipc_tbl->vlmsg_id = msgget(msg_key, msg_flag)) < 0 && errno == EEXIST)
{
errno = 0;
msg_key++;
}

if (errno != 0)
{ // error other than EEXIST occurs
free(ipc_tbl);
return(-1);
}

ipc_tbl->vlkey_id = msg_key;
}
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:19 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0