473,405 Members | 2,334 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,405 software developers and data experts.

Memory Querry

Hi All,

I have simple question regarding the memory allocation and the compiler
optimisation:

Well if I have the file.h in which I declare

const class DMString ACCOUNT_NAME = "AccountName";

in which CompLangString is a class which class

class CompLangString
{
public:
inline BOOLEAN operator==(const CompLangString & s2) const
{return this->operator == (s2.m_pStr);}

}

Now assuma that I have compiled file.c

and I am not using the file.c through out the rest of my code at all.

So my question is do the compiler will acllocate the memory for
ACCOUNT_NAME in heap or not ?

In my perception Compiler will allocate the memory for the above but it
wond optimise as it is Globallly declared.

Please let me know how much I am correct, and pelase do rectify my
knowledge.
Compliler used is gcc

Thanks In Advance
Ranjeet Gupta

Jan 8 '07 #1
2 1150
Just to correct my mistake

ra***********@gmail.com wrote:
Hi All,

I have simple question regarding the memory allocation and the compiler
optimisation:

Well if I have the file.h in which I declare

const class DMString ACCOUNT_NAME = "AccountName";
^^^^^^^^^^^ is CompLangString
>
in which CompLangString is a class which class

class CompLangString
{
public:
inline BOOLEAN operator==(const CompLangString & s2) const
{return this->operator == (s2.m_pStr);}

}

Now assuma that I have compiled file.c

and I am not using the file.c through out the rest of my code at all.

So my question is do the compiler will acllocate the memory for
ACCOUNT_NAME in heap or not ?

In my perception Compiler will allocate the memory for the above but it
wond optimise as it is Globallly declared.

Please let me know how much I am correct, and pelase do rectify my
knowledge.
Compliler used is gcc

Thanks In Advance
Ranjeet Gupta
Jan 8 '07 #2
On 2007-01-08 17:29, ra***********@gmail.com wrote:
Just to correct my mistake

ra***********@gmail.com wrote:
>Hi All,

I have simple question regarding the memory allocation and the compiler
optimisation:

Well if I have the file.h in which I declare

const class DMString ACCOUNT_NAME = "AccountName";
^^^^^^^^^^^ is CompLangString
>>
in which CompLangString is a class which class

class CompLangString
{
public:
inline BOOLEAN operator==(const CompLangString & s2) const
{return this->operator == (s2.m_pStr);}

}

Now assuma that I have compiled file.c

and I am not using the file.c through out the rest of my code at all.

So my question is do the compiler will acllocate the memory for
ACCOUNT_NAME in heap or not ?

In my perception Compiler will allocate the memory for the above but it
wond optimise as it is Globallly declared.

Please let me know how much I am correct, and pelase do rectify my
knowledge.
Compliler used is gcc
Disregarding the fact that the above pieces of code doesn't look much
like C++ to me, and the fact that you have not provided the correct in-
formation to be sure (is the file file.h included anywhere?), I'd say
that any decent compiler should be able to eliminate unused variables.

--
Erik Wikström
Jan 8 '07 #3

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

Similar topics

4
by: Eric Kincl | last post by:
Hey everyone, I know this isn't a SQL group, but I'm on my colleges news server and they don't offer one. Hopefully someone here will be able to help me. I have a database that is normalized...
2
by: Eric Kincl | last post by:
Hello, I have an array of data in PHP. I would like to insert each member of the array into it's own row in SQL. The array is of variable length, so it would have to be dynamic code. How would...
0
by: Costa Lino | last post by:
Hi All, I have a DataSet with xml file and I want to make a querry like this DataView dv = new DataView(mytable); dv.RowFilter = " Impression < ( MaxImpressions) "; Impression et...
3
by: Piotr | last post by:
Hi, I have huge problem, as Access when executing querry (calculating values qty * price) shows the message "Not enough memory to remove changes" or something like this. How can I check what is...
5
by: Clownfish | last post by:
OK, I'm having a brain freeze. I have a table like this: Office Name Phone ---------------------------------- SG Larry 555-1212 SG Moe 553-4444 SG Curly ...
1
Steve Kiss
by: Steve Kiss | last post by:
Hi. I am developping a site for which one of the pages uses querry strings to pass some parameters. I can use the querry strings if I call the page from a plain html anchor. However, when I add the...
1
by: nj2md | last post by:
Can some one assist with a querry. I need to know the code to querry a database to find the number of female and males that make over 50K a year and how to get capital gains and loses from the same...
0
by: getmeidea | last post by:
I have the following tables, 1> employee_master(emp_id int primary key, emp_name varchar(100)); 2> employee_salary_payment(salary_rid int primary key, emp_id int, sal_date date, paid_amt int); ...
2
by: dipalichavan82 | last post by:
i came across a article, where it was mentioned if we want a dynamic querry to fire then use parameterized querry e.g. string inputcity=textbox.text; SqlCommand cmd = new SqlCommand("select * from...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.