Sponsored Content
Full Discussion: constants in C/C++
Top Forums Programming constants in C/C++ Post 26698 by Perderabo on Thursday 22nd of August 2002 09:48:00 AM
Old 08-22-2002
Actually, you are misbehaving, not the compiler. When you violate the rules of a language any behavior by the compiler becomes legal. As for why this particular result happens, code like:
const int x = 10;
printf("%p %d \n", &x, x);

can be rewritten by the compiler as something like:
const int x = 10;
printf("%p 10 \n", &x);

Whether or not this happens is up the compiler. Most compilers have options to control optimizations. By fiddling with these options you may be able to induce both behaviors from both compilers. Or maybe not. "Garbage in, garbage out" applys heavily to compilers.
 

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl: eval and constants

is it possible to use eval to create constants in perl? i cannot seem to get anything to work, and my searches are turning up little to nothing. an example of what i am trying to do is this: 2 arrays: array 1: 'FOOD','NUMBER','OS' array 2: 'pizza','two','unix' loop through the arrays and... (5 Replies)
Discussion started by: effigy
5 Replies

2. Programming

char constants vs. hard-coding

This might be a silly question, but I thought I'd ask anyway. If I'm writing in C, isn't it more efficient to, for instance, use constant character variable set to 'A' instead of hard-coding a character 'A'? Since it's only a single character instead of a string, it might not matter much. (10 Replies)
Discussion started by: cleopard
10 Replies

3. UNIX for Dummies Questions & Answers

Operation with real variables and constants

Hello there, I'd like to define a variable b equal to 0.5/a where a=0.001, so I wrote something like that: a=0.001; let 'b=0.5/$a'; but it doesn't work... maybe because the variable a has a real value??? Any help will be appreciated!!!:D (1 Reply)
Discussion started by: Giordano Bruno
1 Replies
ExtUtils::MM_Win32(3pm) 				 Perl Programmers Reference Guide				   ExtUtils::MM_Win32(3pm)

NAME
ExtUtils::MM_Win32 - methods to override UN*X behaviour in ExtUtils::MakeMaker SYNOPSIS
use ExtUtils::MM_Win32; # Done internally by ExtUtils::MakeMaker if needed DESCRIPTION
See ExtUtils::MM_Unix for a documentation of the methods provided there. This package overrides the implementation of these methods, not the semantics. Overridden methods dlsyms replace_manpage_separator Changes the path separator with . maybe_command Since Windows has nothing as simple as an executable bit, we check the file extension. The PATHEXT env variable will be used to get a list of extensions that might indicate a command, otherwise .com, .exe, .bat and .cmd will be used by default. init_DIRFILESEP Using for Windows. init_tools Override some of the slower, portable commands with Windows specific ones. init_others Override the default link and compile tools. LDLOADLIBS's default is changed to $Config{libs}. Adjustments are made for Borland's quirks needing -L to come first. init_platform Add MM_Win32_VERSION. platform_constants constants Add MAXLINELENGTH for dmake before all the constants are output. special_targets Add .USESHELL target for dmake. static_lib Changes how to run the linker. The rest is duplicate code from MM_Unix. Should move the linker code to its own method. dynamic_lib Complicated stuff for Win32 that I don't understand. :( extra_clean_files Clean out some extra dll.{base,exp} files which might be generated by gcc. Otherwise, take out all *.pdb files. init_linker perl_script Checks for the perl program under several common perl extensions. xs_o This target is stubbed out. Not sure why. pasthru All we send is -nologo to nmake to prevent it from printing its damned banner. arch_check (override) Normalize all arguments for consistency of comparison. oneliner These are based on what command.com does on Win98. They may be wrong for other Windows shells, I don't know. cd dmake can handle Unix style cd'ing but nmake (at least 1.5) cannot. It wants: cd dir1dir2 command another_command cd .... max_exec_len nmake 1.50 limits command length to 2048 characters. os_flavor Windows is Win32. cflags Defines the PERLDLL symbol if we are configured for static building since all code destined for the perl5xx.dll must be compiled with the PERLDLL symbol defined. perl v5.18.2 2014-01-06 ExtUtils::MM_Win32(3pm)
All times are GMT -4. The time now is 02:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy