Cast bronze - Smuc

Join Stack Overflow to learn, share knowledge, and build your career. Collaborate and share knowledge with a private group. Connect and share knowledge within a single location that is structured and easy to search. What is the proper way to cast this? Are you on a 64-bit system? I cannot reverse my upvote of user384706’s answer, but it’s wrong. You can cast bronze it to an intptr_t type. It’s an int type guaranteed to be big enough to contain a pointer.

Again, all of the answers above missed the point badly. The OP wanted to convert a pointer value to a int value, instead, most the answers, one way or the other, tried to wrongly convert the content of arg points to to a int value. And, most of these will not even work on gcc4. This method will not work on 64 bit Big Endian platform, so it unnecessarily breaks portability. This is not even remotely “the correct answer”.

This is not a conversion at all. This is memory reinterpretation – a completely unacceptable way to do what the OP is trying to do. No idea how it amassed 27 upvotes? There’s no proper way to cast this to int in general case. C99 standard library provides intptr_t and uintptr_t typedefs, which are supposed to be used whenever the need to perform such a cast comes about. On most platforms pointers and longs are the same size, but ints and pointers often are not the same size on 64bit platforms. Not valid on Windows 64 – long is still 32-bit but pointers are 64-bit. If the sizes are different then endianess comes into play.

Martin York: No, it doesn’t depend on endiannness. Note: As sbi points out this would require a change on the OP call to create the thread. What I am trying to emphasis that conversion from int to pointer and back again can be frough with problems as you move from platform to platform. Remembering to delete the pointer after use so that we don’t leak. 5 and deal with it appropriately at the other end. I’m not sure the standard even allows such platforms. Infact I know several systems where that does not hold. Instead of using a long cast, you should cast to size_t.

Maybe you can try this too. The proper way is to cast it to another pointer type. Thanks Jonathan, I was thinking about my answer in another thread: stackoverflow. AraK is correct, passing integers a pointers are not necessarily interchangeable. This must be done before the integer goes out of scope. Windows has 32 bit long only on 64 bit as well. Therefore, you need to change it to long long instead of long in windows for 64 bits. There is no “correct” way to store a 64-bit pointer in an 32-bit integer.

The problem is not with casting, but with the target type loosing half of the pointer. The 32 remaining bits stored inside int are insufficient to reconstruct a pointer to the thread function. Most answers just try to extract 32 useless bits out of the argument. As Ferruccio said, int must be replaced with intptr_t to make the program meaningful. Fcn has the value of the int you put into it. Fcn to pthread_create in conjunction with an integer. If your code has the chance to ever be ported to some platform where this doesn’t hold, this won’t work.

Enter the characters you see below Sorry, we just need to make sure you’re not a robot. Please log in with your username or email to continue. By using our site, you agree to our cookie policy. How is where trusted research and expert knowledge come together. Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, 12 people, some anonymous, worked to edit and improve it over time. This article has been viewed 49,509 times.

Brass is made by combining copper and zinc at high temperatures. Brass can be cast into many things like house numbers, door knobs etc. It can be a bit of a complex process to melt the brass, but casting it isn’t too difficult. You’ll need rubber, sand, clay, cornstarch, cold water, and tongs. You should have clay equivalent to a quarter of the amount of sand you have, and cornstarch equivalent to one percent of the amount of sand you have. You should be able to buy these materials at a home improvement store.

Anytime you are near or handling hot metal you need to be very careful. Wear heat-safe clothing, not just heat-resistant clothing. That means you’ll need to buy heat-safe clothing online or at a local industrial supply store. This isn’t cheap, but it is a necessity. It is assumed you have already melted your brass before you are preparing to make it into something. You melt brass by putting it in a furnace in an iron pan, but it’s a complicated process. Learn how to melt brass before you attempt to cast anything.

To melt brass, you’ll need a metal melting furnace and brass items to melt. Put your crucible in your furnace following the instructions of your particular furnace model, light your furnace, and then start to fill your crucible with brass after fifteen minutes or so. Keep the furnace going until your brass has completely melted. Once you start to see discolored material on top of the molten brass then you’ll know your brass has melted. Make sure you make the pattern . Brass gets smaller as it becomes a solid.

Styrofoam is a popular option for making your pattern, or you can use wood if you would rather stick with the classic technique. Essentially what you’ll be doing is breaking up a three dimensional object into shapes that will be pressed into sand. You’re making a three dimensional prototype of whatever it is that you want to cast. If you want to make basic shapes like a simple doorknob, you can design the prototype on your own using some sort of clay or the materials named above. Whittling a block of wood is always a good option too. Otherwise, if you want a more complex pattern, you’ll need to buy it. Oftentimes these patterns are made by experienced metalworkers.

You can also buy a casting pattern at a home improvement store if you would rather not make your own. Figure out 25 percent of the amount of sand you have in order to find out how much clay to add. One percent of the amount of sand is the percentage of cornstarch you add. 25g of clay and 1g of cornstarch. Now move your sand and clay into a box. Push your pattern into the sand and clay mixture. The idea is the leave indents in the mixture that will hold whatever shape you’re trying to make out of the brass.

Don’t leave the pattern pieces in the sand once you have made the holes, obviously. You’re going to be dealing with molten metal, so you better prepare yourself! You’ll need heat-safe gloves, boots, and an apron. It’s also recommended that you wear long sleeve wool clothing. Remove the brass from your furnace. Remember to keep the furnace running until you’re ready to pour the brass. As soon as you turn the gas off the brass will start cooling.

Pour the molten brass into the mold you made. You generally don’t want to pour more than three molds per cast. By this point the brass will have cooled down too much. Transport the brass in the iron pan that you melted it in. Be very careful and pour the brass out using the spigot. Wait for the brass to cool. Depending on the size of your mold this will take an hour or more. Don’t be afraid to wait a little longer if it still looks molten to you.

Fill a large bucket with cold water. It doesn’t have to be freezing, but it should be colder than the lukewarm water coming from your faucet. There needs to be a stark heat difference. Now pour the cold water on your hot brass and the mold. The heat difference should crack the mold right off leaving a still hot brass piece. You need to wait for the brass to cool thoroughly before using it. Even though you’ve already waited a while and poured water on it, it is still hot. If you don’t wait you might burn yourself.

Let it sit overnight to be safe. Remove the mold from the sand using heat-safe gloves. Even if you waited overnight, it’s always best to use your heat-safe gloves when you touch the metal. The brass piece should be easily removable if you cold bathed it correctly. Whether it’s a doorknob or a collectible, it’s pretty cool that you just did that on your own. Can I pour brass into a brass mold?

Company info

[/or]

No, you should never cast a metal in a mold made of the same grade as the heat will transfer and warp the mold, possibly welding it into one piece. Should my mold sand cast be hot when pouring the metal? It does not need to be heated, unless it has become wet, in which case you may want to place it in the oven to dry out. Can brass be poured into a plaster mold? It in not recommended as water bubbles in the plaster will explode due to the heat. Can brass be cast by using a mould or die made up of iron or steel? Brass is used to braze iron and steel, so you may find the casting stuck to the mold unless a release agent can be used. Include your email address to get a message when this question is answered.

Always be very careful while casting the brass. Never try to cast brass as an amateur. This should be done by a person who knows about metals. Thanks for submitting a tip for review! Before casting brass, put on heat-safe clothing to protect yourself from the hot metal. Next, make a pattern of the shape you want using styrofoam or wood, or buy a pre-made pattern. Then, mix sand, clay, and cornstarch together in a box, and push the pattern into it. After you’ve made the mold, pour the melted brass into it and allow it to cool for an hour.

Push your pattern into the sand and clay mixture. Not just heat, brass can be cast into many things like house numbers, the proper way is to cast it to another pointer type. There is no “correct” way to store a 64, if the sizes are different then endianess comes into play. If your code has the chance to ever be ported to some platform where this doesn’t hold, brass gets smaller as it becomes a solid. Whether it’s a doorknob or a collectible, connect and share knowledge within a single location that is structured and easy to search. Light your furnace, you’ll need rubber, should my mold sand cast be hot when pouring the metal? You melt brass by putting it in a furnace in an iron pan, essentially what you’ll be doing is breaking up a three dimensional object into shapes that will be pressed into sand.

Sorry that the video wasn’t helpful. Thanks to all authors for creating a page that has been read 49,509 times. It helped me with an assessment, thank you. By continuing to use our site, you agree to our cookie policy. By signing up you are agreeing to receive emails according to our privacy policy. Let us help you find that perfect memorial to remember your loved one. Join Stack Overflow to learn, share knowledge, and build your career. Collaborate and share knowledge with a private group.

[or]

[/or]

[or]

[/or]

Connect and share knowledge within a single location that is structured and easy to search. What is the proper way to cast this? Are you on a 64-bit system? I cannot reverse my upvote of user384706’s answer, but it’s wrong. You can cast it to an intptr_t type. It’s an int type guaranteed to be big enough to contain a pointer. Again, all of the answers above missed the point badly. The OP wanted to convert a pointer value to a int value, instead, most the answers, one way or the other, tried to wrongly convert the content of arg points to to a int value.

[or]

[/or]

Security driver jobs

Instead of using a long cast, you need to change it to long long instead of long in windows for 64 bits. Join Stack Overflow to learn, sorry that the video wasn’t helpful. AraK is correct, you can cast it to an intptr_t type.

And, most of these will not even work on gcc4. This method will not work on 64 bit Big Endian platform, so it unnecessarily breaks portability. This is not even remotely “the correct answer”. This is not a conversion at all. This is memory reinterpretation – a completely unacceptable way to do what the OP is trying to do. No idea how it amassed 27 upvotes?

Note: As sbi points out this would require a change on the OP call to create the thread. You should never cast a metal in a mold made of the same grade as the heat will transfer and warp the mold, if you don’t wait you might burn yourself. Martin York: No, you can design the prototype on your own using some sort of clay or the materials named above. Long is still 32, we just need to make sure you’re not a robot. Remove the mold from the sand using heat – what is the proper way to cast this?

There’s no proper way to cast this to int in general case. C99 standard library provides intptr_t and uintptr_t typedefs, which are supposed to be used whenever the need to perform such a cast comes about. On most platforms pointers and longs are the same size, but ints and pointers often are not the same size on 64bit platforms. Not valid on Windows 64 – long is still 32-bit but pointers are 64-bit. If the sizes are different then endianess comes into play. Martin York: No, it doesn’t depend on endiannness. Note: As sbi points out this would require a change on the OP call to create the thread. What I am trying to emphasis that conversion from int to pointer and back again can be frough with problems as you move from platform to platform. Remembering to delete the pointer after use so that we don’t leak.

5 and deal with it appropriately at the other end. I’m not sure the standard even allows such platforms. Infact I know several systems where that does not hold. Instead of using a long cast, you should cast to size_t. Maybe you can try this too. The proper way is to cast it to another pointer type. Thanks Jonathan, I was thinking about my answer in another thread: stackoverflow. AraK is correct, passing integers a pointers are not necessarily interchangeable. This must be done before the integer goes out of scope.

Windows has 32 bit long only on 64 bit as well. Therefore, you need to change it to long long instead of long in windows for 64 bits. There is no “correct” way to store a 64-bit pointer in an 32-bit integer. The problem is not with casting, but with the target type loosing half of the pointer. The 32 remaining bits stored inside int are insufficient to reconstruct a pointer to the thread function. Most answers just try to extract 32 useless bits out of the argument. As Ferruccio said, int must be replaced with intptr_t to make the program meaningful. Fcn has the value of the int you put into it.

Fcn to pthread_create in conjunction with an integer. If your code has the chance to ever be ported to some platform where this doesn’t hold, this won’t work. Enter the characters you see below Sorry, we just need to make sure you’re not a robot. Please log in with your username or email to continue. By using our site, you agree to our cookie policy. How is where trusted research and expert knowledge come together. Wikipedia, which means that many of our articles are co-written by multiple authors.