﻿# V2533\. MISRA\. C\-style and functional notation casts should not be performed\.

This diagnostic rule is based on the software development guidelines developed by [MISRA](https://www.misra.org.uk/) \(Motor Industry Software Reliability Association\)\.

This rule only applies to C\+\+\.

C\-style and functional casting can convert unrelated types which may lead to an error\.

You must explicitly cast types using the operators 'static\_cast', 'const\_cast' and 'reinterpret\_cast'\.

Examples, for which the analyzer will issue warnings: 

```cpp
int i;
double d;
size_t s;
void *p;
....
i = int(p);      //V2533
d = (double)s;   //V2533
s = (size_t)(i); //V2533 
p = (void *)(d); //V2533
```

Exception: casting to void does not constitute any danger and is used to emphasize that a certain result is not used in any way\. Example: 

```cpp
(void)fclose(f);
```