Solved

warning C4090

Posted on 2006-07-14
8
1,344 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
  • 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
 

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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use pointers 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.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now