Solved

warning C4090

Posted on 2006-07-14
8
1,360 Views
Last Modified: 2012-05-05

Hello,

I got the following error: warning C4090: '=' : different const or volatile qualifiers

anyone knows why?

Thanks
0
Comment
Question by:TungVan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 53

Expert Comment

by:Infinity08
ID: 17108640
you're trying to assign a variable with the const or volatile qualifier to a variable that doesn't have that qualifier.

Check here for more info :

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/C4090.asp
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 17108647
Can you show the code that generates the warning, as well as the definitions of the variables used in that line ?
0
 

Author Comment

by:TungVan
ID: 17108722

void AddBSMaybe(LPSTR pszPath)
{
      int nPos;

      nPos = lstrlen(pszPath)-1;

      /* if no backslash, then add one */
      if(pszPath[nPos] != '\\')
            lstrcat(pszPath,"\\");
}
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:TungVan
ID: 17108735
void DelBSMaybe(LPSTR pszPath)
{
      int nPos;

      nPos = lstrlen(pszPath)-1;

      /* if backslash, then zap it */
      if(pszPath[nPos] == '\\')
            pszPath[nPos] = 0x00;
}

BOOL DoDirVerify(LPSTR pszPath, LPSTR pszDirName)
{
      char szPath[MAXPATHLENGTH]={0};

      lstrcpy(szPath,pszPath);

      if(pszDirName != NULL)
      {
            /* add sub-dir name */
            AddBSMaybe(szPath);
            
            lstrcat(szPath,pszDirName);
            
      }
      
      DelBSMaybe(szPath);
      
      /* check for existence and return */
      return (! _access(szPath,00));            
}
0
 

Author Comment

by:TungVan
ID: 17108743

I also get error: error C2057: expected constant expression

in the DoDirVerify function
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 17108792
At what line does the warning occur ? Because I don't see anything wrong here that could trigger this warning.
0
 
LVL 53

Accepted Solution

by:
Infinity08 earned 50 total points
ID: 17108857
>> I also get error: error C2057: expected constant expression
That's because the _access() function expects a const char* as first argument :

http://msdn2.microsoft.com/en-us/library/1w06ktdy.aspx
0
 

Author Comment

by:TungVan
ID: 17108994

sorry for the C4090 warning. It happens in another function coded before AddBSMaybe()

Thanks for your help
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question