473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

evaluating builtin [] during initialization

It seems like it would not be hard for the optimizer to generate the
same
object code from this source code:

int x[] = { 3, 6, 9 };
int y = x[1];

as it does from this source code:

int x[] = { 3, 6, 9 };
int y = 6;

But it tried two compilers, with optimization enabled, and both
generated
"pre-main" executable code to initialize y (when it's assinged from
x[1]).

Anyone seen a compiler that does optimize out builtin [] in
initializers?
Or, anyone know why it is hard/bad to optimize [] out?

Jul 5 '06 #1
1 1090
posted:

int x[] = { 3, 6, 9 };
int y = x[1];


Try:

int const x[] = { 3, 6, 9 };
And see if it makes a difference. (Or have you already tried that, and are
now experimenting with non-const arrays... ?)

--

Frederick Gotham
Jul 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stephen Ferg | last post by:
Python has a builtin class for staticmethod. Seems to me that Python should also have a builtin class for abstractmethod. Something like this... ####################################### #...
1
by: admin | last post by:
Hi all, I wrote a small text editor (using a JTextPane) in order to ease the use of a CMS, in a more WYSIWYG way. Basically, you can see directly the effect of setting the background color, the...
11
by: Rangi Keen | last post by:
I am instantiating an XmlSerializer using the XmlSerializer(Type) constructor. This works most of the time, but sometimes I get a timeout during the process. I'm using the same type in all cases...
1
by: kosta | last post by:
hello! I have this code: public static DataSet DSet(String sql) { OleDbConnection con = new OleDbConnection(); con.ConnectionString = ConfigurationSettings.AppSettings; OleDbCommand cmd =...
6
by: Anders K. Olsen | last post by:
Hello group I'm trying to list the users and groups who has read access to a file. I use .NET 2.0 and FileInfo.GetAccessControl().GetAccessRules(...) and then loop through the...
4
by: Pål Andreassen | last post by:
We are using a TreeView defined in a MasterPage for navigation. The tree holds it's state turing postbacks just fine since it's using viewstate. But whenever a node click results in a redirect to a...
1
by: Ken Jones | last post by:
Hi all, I am new to VB.NET and would like to get some help. I have a VB.NET Windows application that connects to my development SQLServer during development. I use the VS 2005 designer to...
0
by: nejucomo | last post by:
Hi folks, Quick Synopsis: A test script demonstrates a memory leak when I use pythonic extensions of my builtin types, but if I use the builtin types themselves there is no memory leak. ...
0
by: satishwise | last post by:
HELLO EVERYONE PLEASE HELP ME ON THIS I followed the installation instructions from the oracle 9i built in documentation and started the installation with the Result of this output on my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.