title: Is it possible to have a pointer literal?
body: <p>In C one can have string literals in the form of</p>
  
  <pre><code>char *string = "string here";
  </code></pre>
  
  <p>integer literals:</p>
  
  <pre><code>uint8_t num = 5;
  </code></pre>
  
  <p>long literals:</p>
  
  <pre><code>long long bigNum = 90322L; 
  </code></pre>
  
  <p>floating point literals:</p>
  
  <pre><code>float decimal = 6.3f;
  </code></pre>
  
  <p>Is the a way to have a pointer literal? That is a literal address to a memory space. I am doing some work on an embedded project and need to hard code a value for a DMA access. I am doing something similar to the following:</p>
  
  <pre><code>uint32_t *source = 0x08000000;
  </code></pre>
  
  <p>While this compiles and works correctly I get the following compiler error (I'm using a variant of <code>GCC</code>):</p>
  
  <pre><code>cc0144: {D} warning: a value of type "int" cannot be used to initialize an entity of type "uint32_t *"
  cc0152: {D} warning: conversion of nonzero integer to pointer
  </code></pre>
  
  <p>Is there a correct way to do this or do I just need to accept this as a fact of C? I know I can do:</p>
  
  <pre><code>uint32_t *source = (uint32_t *)0x08000000;
  </code></pre>
  
  <p>But that just seems very unnecessary. What is the industry way of doing this? I am also wondering if this feature exists in C++.</p>