references

What's the Difference Between func(int &param) and func(int *param)?

In the following code, both amp_swap() and star_swap() seems to be doing the same thing. So why will someone prefer to use one over the other? Which one is the preferred notation and why? Or is it just a matter of taste? #include <iostream> using namespace std; void amp_swap(int &x, int &y) { int temp = x; x = y; y = temp;...

How to detect when an object is no longer referenced

Is there a way to create register a handler that will be called exactly at the time when the last reference to a certain object is released? An example would be an object that is backed by a physical data file and once the object become unreferenced, the file should be closed and than renamed. It would be nice if this was possible witho...

The located assembly's manifest definition does not match the assembly reference

I am trying to run some unit tests in a C# winforms application (VS 2005) and I get the following error: System.IO.FileLoadException: Could not load file or assembly 'Utility, Version=1.2.0.200, Culture=neutral, PublicKeyToken=764d581291d764f7' or one of its dependencies. The located assembly's manifest definition does not match the ass...

Better to return a C++ reference or a weak_ptr?

Suppose I have a class where I want the user to be able to have a reference to one of my members. Which is preferred? class Member; class ClassWithWeakPtr { private: boost::shared_ptr<Member> _member; public: boost::weak_ptr<Member> GetMember(); }; or class Member; class ClassWithCppReference { private: Member _member; pu...

Are there gotchas using varargs with reference parameters

I have this piece of code (summarized)... AnsiString working(AnsiString format,...) { va_list argptr; AnsiString buff; va_start(argptr, format); buff.vprintf(format.c_str(), argptr); va_end(argptr); return buff; } And, on the basis that pass by reference is preferred where possible, I changed it thusly. Ansi...

What is a good design pattern in C# for classes that need to reference other classes?

I am working on a business problem in C#.NET. I have two classes, named C and W that will be instantiated independently at different times. An object of class C needs to contain references to 0 ... n objects of class W, i.e. a C object can contain up to n W objects. Each W object needs to contain a reference to exactly 1 object of cla...

Passing pointers/references to structs into functions

This is going to sound like a silly question, but I'm still learning C, so please bear with me. :) I'm working on chapter 6 of K&R (structs), and thus far through the book have seen great success. I decided to work with structs pretty heavily, and therefore did a lot of work early in the chapter with the point and rect examples. One of ...

COM/Interop - Supporting Multiple Versions

I've written a .NET console app that wraps CuteFTP's Transfer Engine - a COM object (ftpte). The version I wrapped is CuteFTP 7.0. I'd like to also support the 8.0 version, as some of the clients I integrate with have that version. I have a reference in my Visual Studio project to the CuteFTP COM object... how can I reference the vers...

Eclipse Europa search references feature stopped working

I'm working with Eclipse Version 3.2.1 Build M20060921-0945 on a MS-Windows 2000 SP4 using a JDK 1.5.0-12. I takes my locale that is es-AR and sets all menu and context in Spanish which I don't like. So I had included in eclipse.ini file one parameter "-nl en". Since that, "References..." feature in both "Search" and contextual menu stop...

.NET Assembly References Compile Time Errors

I have assembly A with class Z that inherits from class X in assembly B. Now in a completely different solution, I have assembly C, which uses class Z. The compiler complains unless assembly C has a reference to both assembly A & B. Even though assembly C does not use class Z directly in anyway. Is this expected? It seems to me that i...

How do I manage deployment item references that may either be on an x86 install, or x64 install for an MSTest-based project?

Much related to this question, we have a scenario on my team where we need to copy the contents of a folder for a suite of libraries and configuration files for said libraries to our folder where our test code is running from, as part of the test's deployment step. Due to the installation size, and other factors, checking in this instal...

Dependencies and references - What exactly should I reference?

I am wondering what to include when building my project. I have a library I need to reference for my project to build but that library has 10 dependencies itself. Should I reference those dependencies as well or should I copy them to the output directory using a post build event? What is the best practice? I find it confusing to includ...

Build Via NAnt vs Visual Studio - One dll Missing

My solution includes these two projects: MyNamespace.Web.UI MyNamespace.Web.Core UI references Core, and Core references Foobar.dll, which exists nowhere except my library. When I build from Visual Studio 2008 Foobar.dll is in the UI project's Bin folder as expected. I have made certain it was not there before the build. But whe...

What use is the Aliases property of assembly references in Visual Studio 8.

When I add an assembly reference to a project in Visual Studio 8 the Aliases property, of that reference, is set to "global". What is this property good for and why is it set to global? MSDN tells me that this is a list of aliases for the assembly but not why I might want to use this property or why most are aliased as "global". MSDN ...

How to reference two versions of an API ?

Hi I have a need to reference two different versions of the Sharepoint API dll. I have a webservice that needs to run under both Sharepoint 2 and Sharepoint 3, but also needs to work with new features provided by the Sharepoint 3 API (Checkout and Content Approval) What is the best way to acheive this - I'm currently leaning towards h...

What is the widget name of the Kde bar used in program like Kate? (image inside)

What is the object name of the Kde bar that provide buttons to hide/unhide widgets? I can't find on kde official API references. It's used in program like Kate, Kdevelop. Here the screenshot of the bar of Kate bottom: http://emilio.plugs.it/bar.png ...

Weak references

can someone explain the main benefits of different types of references in C#, weak references, soft references, phantom references, strong references. We have an application that is consuming a lot of memory and we are trying to determine if this is an area to focus on. ...

PHP new operator returning reference

I'm working with some old PHP code that has a lot of the following: $someVar =& new SomeClass(); Did the new operator ever return a value, um, not by reference? (That feels strange to type. I feel like I'm losing my mind.) ...

Execution speed of references vs pointers

I recently read a discussion regarding whether managed languages are slower (or faster) than native languages (specifically C# vs C++). One person that contributed to the discussion said that the JIT compilers of managed languages would be able to make optimizations regarding references that simply isn't possible in languages that use po...

ASP.NET Website's BIN directory and references

Imagine the following solution: -Website ABC.com (not Web Application) -BLL (business logic layer in a seperate assembly) -DTO (dto objects in their own assembly) -DAL (data access layer in it's own assembly as well). The BLL has a reference to the DAL. The BLL has a reference to the DTO layer. The Website project references the BLL. ...